Merge pull request #135 from TheBlueMatt/main
[ldk-java] / ts / bindings.c.body
1 #include "js-wasm.h"
2 #include <stdatomic.h>
3 #include <lightning.h>
4
5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
9
10 extern void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12         if (!expression) { abort(); }
13 }
14
15 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
16         return val == 0xdeadbeef0badf00dULL;
17 }
18
19
20 void *malloc(size_t size);
21 void free(void *ptr);
22
23 #define MALLOC(a, _) malloc(a)
24 #define do_MALLOC(a, _b, _c) malloc(a)
25 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
26 #define DO_ASSERT(a) (void)(a)
27 #define CHECK(a)
28 #define CHECK_ACCESS(p)
29 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
30
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35
36 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
37
38 #define DECL_ARR_TYPE(ty, name) \
39         struct name##array { \
40                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
41                 ty elems[]; \
42         }; \
43         typedef struct name##array * name##Array; \
44         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
45                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
46                 arr->arr_len = arr_len; \
47                 return arr; \
48         }
49
50 DECL_ARR_TYPE(int64_t, int64_t);
51 DECL_ARR_TYPE(uint64_t, uint64_t);
52 DECL_ARR_TYPE(int8_t, int8_t);
53 DECL_ARR_TYPE(int16_t, int16_t);
54 DECL_ARR_TYPE(uint32_t, uint32_t);
55 DECL_ARR_TYPE(void*, ptr);
56 DECL_ARR_TYPE(char, char);
57 typedef charArray jstring;
58
59 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
60         charArray arr = init_charArray(len, __LINE__);
61         memcpy(arr->elems, chars, len);
62         return arr;
63 }
64 static inline LDKStr str_ref_to_owned_c(const jstring str) {
65         char* newchars = MALLOC(str->arr_len + 1, "String chars");
66         memcpy(newchars, str->elems, str->arr_len);
67         newchars[str->arr_len] = 0;
68         LDKStr res = {
69                 .chars = newchars,
70                 .len = str->arr_len,
71                 .chars_is_owned = true
72         };
73         return res;
74 }
75
76 typedef bool jboolean;
77
78 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
79         return (uint32_t)MALLOC(size, "JS-Called malloc");
80 }
81 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
82         FREE((void*)ptr);
83 }
84
85 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
86         const char *res = check_get_ldk_bindings_version();
87         if (res == NULL) return NULL;
88         return str_ref_to_ts(res, strlen(res));
89 }
90 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
91         const char *res = check_get_ldk_version();
92         if (res == NULL) return NULL;
93         return str_ref_to_ts(res, strlen(res));
94 }
95 #include "version.c"
96 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
97
98 static inline void* untag_ptr(uint64_t ptr) {
99         if (ptr < 4096) return (void*)ptr;
100         if (sizeof(void*) == 4) {
101                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
102                 return (void*)(uintptr_t)ptr;
103         } else {
104                 // For 64-bit systems, assume the top byte is used for tagging, then
105                 // use bit 9 ^ bit 10.
106                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
107                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
108 #ifdef LDK_DEBUG_BUILD
109                 // On debug builds we also use the 11th bit as a debug flag
110                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
111                 CHECK(tenth_bit != eleventh_bit);
112                 p ^= 1ULL << 53;
113 #endif
114                 return (void*)p;
115         }
116 }
117 static inline bool ptr_is_owned(uint64_t ptr) {
118         if(ptr < 4096) return true;
119         if (sizeof(void*) == 4) {
120                 return ptr & (1ULL << 32);
121         } else {
122                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
123                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
124 #ifdef LDK_DEBUG_BUILD
125                 // On debug builds we also use the 11th bit as a debug flag
126                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
127                 CHECK(tenth_bit != eleventh_bit);
128 #endif
129                 return (ninth_bit ^ tenth_bit) ? true : false;
130         }
131 }
132 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
133         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
134         if (sizeof(void*) == 4) {
135                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
136         } else {
137                 CHECK(sizeof(uintptr_t) == 8);
138                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
139                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
140 #ifdef LDK_DEBUG_BUILD
141                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
142                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
143                 CHECK(ninth_bit == tenth_bit);
144                 CHECK(ninth_bit == eleventh_bit);
145                 t ^= 1ULL << 53;
146 #endif
147                 CHECK(ptr_is_owned(t) == is_owned);
148                 CHECK(untag_ptr(t) == ptr);
149                 return t;
150         }
151 }
152
153 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_js(int32_t ord) {
154         switch (ord) {
155                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
156                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
157                 case 2: return LDKBolt11SemanticError_NoDescription;
158                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
159                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
160                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
161                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
162                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
163                 case 8: return LDKBolt11SemanticError_InvalidSignature;
164                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
165         }
166         abort();
167 }
168 static inline int32_t LDKBolt11SemanticError_to_js(LDKBolt11SemanticError val) {
169         switch (val) {
170                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
171                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
172                 case LDKBolt11SemanticError_NoDescription: return 2;
173                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
174                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
175                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
176                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
177                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
178                 case LDKBolt11SemanticError_InvalidSignature: return 8;
179                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
180                 default: abort();
181         }
182 }
183 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_js(int32_t ord) {
184         switch (ord) {
185                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
186                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
187                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
188                 case 3: return LDKBolt12SemanticError_MissingAmount;
189                 case 4: return LDKBolt12SemanticError_InvalidAmount;
190                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
191                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
192                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
193                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
194                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
195                 case 10: return LDKBolt12SemanticError_MissingDescription;
196                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
197                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
198                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
199                 case 14: return LDKBolt12SemanticError_MissingQuantity;
200                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
201                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
202                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
203                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
204                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
205                 case 20: return LDKBolt12SemanticError_MissingPayerId;
206                 case 21: return LDKBolt12SemanticError_MissingPaths;
207                 case 22: return LDKBolt12SemanticError_InvalidPayInfo;
208                 case 23: return LDKBolt12SemanticError_MissingCreationTime;
209                 case 24: return LDKBolt12SemanticError_MissingPaymentHash;
210                 case 25: return LDKBolt12SemanticError_MissingSignature;
211         }
212         abort();
213 }
214 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
215         switch (val) {
216                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
217                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
218                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
219                 case LDKBolt12SemanticError_MissingAmount: return 3;
220                 case LDKBolt12SemanticError_InvalidAmount: return 4;
221                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
222                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
223                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
224                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
225                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
226                 case LDKBolt12SemanticError_MissingDescription: return 10;
227                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
228                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
229                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
230                 case LDKBolt12SemanticError_MissingQuantity: return 14;
231                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
232                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
233                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
234                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
235                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
236                 case LDKBolt12SemanticError_MissingPayerId: return 20;
237                 case LDKBolt12SemanticError_MissingPaths: return 21;
238                 case LDKBolt12SemanticError_InvalidPayInfo: return 22;
239                 case LDKBolt12SemanticError_MissingCreationTime: return 23;
240                 case LDKBolt12SemanticError_MissingPaymentHash: return 24;
241                 case LDKBolt12SemanticError_MissingSignature: return 25;
242                 default: abort();
243         }
244 }
245 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
246         switch (ord) {
247                 case 0: return LDKCOption_NoneZ_Some;
248                 case 1: return LDKCOption_NoneZ_None;
249         }
250         abort();
251 }
252 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
253         switch (val) {
254                 case LDKCOption_NoneZ_Some: return 0;
255                 case LDKCOption_NoneZ_None: return 1;
256                 default: abort();
257         }
258 }
259 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
260         switch (ord) {
261                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
262                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
263                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
264         }
265         abort();
266 }
267 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
268         switch (val) {
269                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
270                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
271                 case LDKChannelMonitorUpdateStatus_PermanentFailure: return 2;
272                 default: abort();
273         }
274 }
275 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
276         switch (ord) {
277                 case 0: return LDKChannelShutdownState_NotShuttingDown;
278                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
279                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
280                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
281                 case 4: return LDKChannelShutdownState_ShutdownComplete;
282         }
283         abort();
284 }
285 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
286         switch (val) {
287                 case LDKChannelShutdownState_NotShuttingDown: return 0;
288                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
289                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
290                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
291                 case LDKChannelShutdownState_ShutdownComplete: return 4;
292                 default: abort();
293         }
294 }
295 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
296         switch (ord) {
297                 case 0: return LDKConfirmationTarget_MempoolMinimum;
298                 case 1: return LDKConfirmationTarget_Background;
299                 case 2: return LDKConfirmationTarget_Normal;
300                 case 3: return LDKConfirmationTarget_HighPriority;
301         }
302         abort();
303 }
304 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
305         switch (val) {
306                 case LDKConfirmationTarget_MempoolMinimum: return 0;
307                 case LDKConfirmationTarget_Background: return 1;
308                 case LDKConfirmationTarget_Normal: return 2;
309                 case LDKConfirmationTarget_HighPriority: return 3;
310                 default: abort();
311         }
312 }
313 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
314         switch (ord) {
315                 case 0: return LDKCreationError_DescriptionTooLong;
316                 case 1: return LDKCreationError_RouteTooLong;
317                 case 2: return LDKCreationError_TimestampOutOfBounds;
318                 case 3: return LDKCreationError_InvalidAmount;
319                 case 4: return LDKCreationError_MissingRouteHints;
320                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
321         }
322         abort();
323 }
324 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
325         switch (val) {
326                 case LDKCreationError_DescriptionTooLong: return 0;
327                 case LDKCreationError_RouteTooLong: return 1;
328                 case LDKCreationError_TimestampOutOfBounds: return 2;
329                 case LDKCreationError_InvalidAmount: return 3;
330                 case LDKCreationError_MissingRouteHints: return 4;
331                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
332                 default: abort();
333         }
334 }
335 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
336         switch (ord) {
337                 case 0: return LDKCurrency_Bitcoin;
338                 case 1: return LDKCurrency_BitcoinTestnet;
339                 case 2: return LDKCurrency_Regtest;
340                 case 3: return LDKCurrency_Simnet;
341                 case 4: return LDKCurrency_Signet;
342         }
343         abort();
344 }
345 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
346         switch (val) {
347                 case LDKCurrency_Bitcoin: return 0;
348                 case LDKCurrency_BitcoinTestnet: return 1;
349                 case LDKCurrency_Regtest: return 2;
350                 case LDKCurrency_Simnet: return 3;
351                 case LDKCurrency_Signet: return 4;
352                 default: abort();
353         }
354 }
355 static inline LDKFailureCode LDKFailureCode_from_js(int32_t ord) {
356         switch (ord) {
357                 case 0: return LDKFailureCode_TemporaryNodeFailure;
358                 case 1: return LDKFailureCode_RequiredNodeFeatureMissing;
359                 case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails;
360         }
361         abort();
362 }
363 static inline int32_t LDKFailureCode_to_js(LDKFailureCode val) {
364         switch (val) {
365                 case LDKFailureCode_TemporaryNodeFailure: return 0;
366                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
367                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
368                 default: abort();
369         }
370 }
371 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
372         switch (ord) {
373                 case 0: return LDKHTLCClaim_OfferedTimeout;
374                 case 1: return LDKHTLCClaim_OfferedPreimage;
375                 case 2: return LDKHTLCClaim_AcceptedTimeout;
376                 case 3: return LDKHTLCClaim_AcceptedPreimage;
377                 case 4: return LDKHTLCClaim_Revocation;
378         }
379         abort();
380 }
381 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
382         switch (val) {
383                 case LDKHTLCClaim_OfferedTimeout: return 0;
384                 case LDKHTLCClaim_OfferedPreimage: return 1;
385                 case LDKHTLCClaim_AcceptedTimeout: return 2;
386                 case LDKHTLCClaim_AcceptedPreimage: return 3;
387                 case LDKHTLCClaim_Revocation: return 4;
388                 default: abort();
389         }
390 }
391 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
392         switch (ord) {
393                 case 0: return LDKIOError_NotFound;
394                 case 1: return LDKIOError_PermissionDenied;
395                 case 2: return LDKIOError_ConnectionRefused;
396                 case 3: return LDKIOError_ConnectionReset;
397                 case 4: return LDKIOError_ConnectionAborted;
398                 case 5: return LDKIOError_NotConnected;
399                 case 6: return LDKIOError_AddrInUse;
400                 case 7: return LDKIOError_AddrNotAvailable;
401                 case 8: return LDKIOError_BrokenPipe;
402                 case 9: return LDKIOError_AlreadyExists;
403                 case 10: return LDKIOError_WouldBlock;
404                 case 11: return LDKIOError_InvalidInput;
405                 case 12: return LDKIOError_InvalidData;
406                 case 13: return LDKIOError_TimedOut;
407                 case 14: return LDKIOError_WriteZero;
408                 case 15: return LDKIOError_Interrupted;
409                 case 16: return LDKIOError_Other;
410                 case 17: return LDKIOError_UnexpectedEof;
411         }
412         abort();
413 }
414 static inline int32_t LDKIOError_to_js(LDKIOError val) {
415         switch (val) {
416                 case LDKIOError_NotFound: return 0;
417                 case LDKIOError_PermissionDenied: return 1;
418                 case LDKIOError_ConnectionRefused: return 2;
419                 case LDKIOError_ConnectionReset: return 3;
420                 case LDKIOError_ConnectionAborted: return 4;
421                 case LDKIOError_NotConnected: return 5;
422                 case LDKIOError_AddrInUse: return 6;
423                 case LDKIOError_AddrNotAvailable: return 7;
424                 case LDKIOError_BrokenPipe: return 8;
425                 case LDKIOError_AlreadyExists: return 9;
426                 case LDKIOError_WouldBlock: return 10;
427                 case LDKIOError_InvalidInput: return 11;
428                 case LDKIOError_InvalidData: return 12;
429                 case LDKIOError_TimedOut: return 13;
430                 case LDKIOError_WriteZero: return 14;
431                 case LDKIOError_Interrupted: return 15;
432                 case LDKIOError_Other: return 16;
433                 case LDKIOError_UnexpectedEof: return 17;
434                 default: abort();
435         }
436 }
437 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
438         switch (ord) {
439                 case 0: return LDKLevel_Gossip;
440                 case 1: return LDKLevel_Trace;
441                 case 2: return LDKLevel_Debug;
442                 case 3: return LDKLevel_Info;
443                 case 4: return LDKLevel_Warn;
444                 case 5: return LDKLevel_Error;
445         }
446         abort();
447 }
448 static inline int32_t LDKLevel_to_js(LDKLevel val) {
449         switch (val) {
450                 case LDKLevel_Gossip: return 0;
451                 case LDKLevel_Trace: return 1;
452                 case LDKLevel_Debug: return 2;
453                 case LDKLevel_Info: return 3;
454                 case LDKLevel_Warn: return 4;
455                 case LDKLevel_Error: return 5;
456                 default: abort();
457         }
458 }
459 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
460         switch (ord) {
461                 case 0: return LDKNetwork_Bitcoin;
462                 case 1: return LDKNetwork_Testnet;
463                 case 2: return LDKNetwork_Regtest;
464                 case 3: return LDKNetwork_Signet;
465         }
466         abort();
467 }
468 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
469         switch (val) {
470                 case LDKNetwork_Bitcoin: return 0;
471                 case LDKNetwork_Testnet: return 1;
472                 case LDKNetwork_Regtest: return 2;
473                 case LDKNetwork_Signet: return 3;
474                 default: abort();
475         }
476 }
477 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
478         switch (ord) {
479                 case 0: return LDKPaymentFailureReason_RecipientRejected;
480                 case 1: return LDKPaymentFailureReason_UserAbandoned;
481                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
482                 case 3: return LDKPaymentFailureReason_PaymentExpired;
483                 case 4: return LDKPaymentFailureReason_RouteNotFound;
484                 case 5: return LDKPaymentFailureReason_UnexpectedError;
485         }
486         abort();
487 }
488 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
489         switch (val) {
490                 case LDKPaymentFailureReason_RecipientRejected: return 0;
491                 case LDKPaymentFailureReason_UserAbandoned: return 1;
492                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
493                 case LDKPaymentFailureReason_PaymentExpired: return 3;
494                 case LDKPaymentFailureReason_RouteNotFound: return 4;
495                 case LDKPaymentFailureReason_UnexpectedError: return 5;
496                 default: abort();
497         }
498 }
499 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
500         switch (ord) {
501                 case 0: return LDKRecipient_Node;
502                 case 1: return LDKRecipient_PhantomNode;
503         }
504         abort();
505 }
506 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
507         switch (val) {
508                 case LDKRecipient_Node: return 0;
509                 case LDKRecipient_PhantomNode: return 1;
510                 default: abort();
511         }
512 }
513 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
514         switch (ord) {
515                 case 0: return LDKRetryableSendFailure_PaymentExpired;
516                 case 1: return LDKRetryableSendFailure_RouteNotFound;
517                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
518         }
519         abort();
520 }
521 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
522         switch (val) {
523                 case LDKRetryableSendFailure_PaymentExpired: return 0;
524                 case LDKRetryableSendFailure_RouteNotFound: return 1;
525                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
526                 default: abort();
527         }
528 }
529 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
530         switch (ord) {
531                 case 0: return LDKSecp256k1Error_IncorrectSignature;
532                 case 1: return LDKSecp256k1Error_InvalidMessage;
533                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
534                 case 3: return LDKSecp256k1Error_InvalidSignature;
535                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
536                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
537                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
538                 case 7: return LDKSecp256k1Error_InvalidTweak;
539                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
540                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
541                 case 10: return LDKSecp256k1Error_InvalidParityValue;
542         }
543         abort();
544 }
545 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
546         switch (val) {
547                 case LDKSecp256k1Error_IncorrectSignature: return 0;
548                 case LDKSecp256k1Error_InvalidMessage: return 1;
549                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
550                 case LDKSecp256k1Error_InvalidSignature: return 3;
551                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
552                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
553                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
554                 case LDKSecp256k1Error_InvalidTweak: return 7;
555                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
556                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
557                 case LDKSecp256k1Error_InvalidParityValue: return 10;
558                 default: abort();
559         }
560 }
561 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
562         switch (ord) {
563                 case 0: return LDKSiPrefix_Milli;
564                 case 1: return LDKSiPrefix_Micro;
565                 case 2: return LDKSiPrefix_Nano;
566                 case 3: return LDKSiPrefix_Pico;
567         }
568         abort();
569 }
570 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
571         switch (val) {
572                 case LDKSiPrefix_Milli: return 0;
573                 case LDKSiPrefix_Micro: return 1;
574                 case LDKSiPrefix_Nano: return 2;
575                 case LDKSiPrefix_Pico: return 3;
576                 default: abort();
577         }
578 }
579 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
580         switch (ord) {
581                 case 0: return LDKUtxoLookupError_UnknownChain;
582                 case 1: return LDKUtxoLookupError_UnknownTx;
583         }
584         abort();
585 }
586 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
587         switch (val) {
588                 case LDKUtxoLookupError_UnknownChain: return 0;
589                 case LDKUtxoLookupError_UnknownTx: return 1;
590                 default: abort();
591         }
592 }
593 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
594         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
595         return ret;
596 }
597 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
598         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
599         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
600         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
601         return ret_arr;
602 }
603
604 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
605 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
606         if (!ptr_is_owned(thing)) return;
607         void* thing_ptr = untag_ptr(thing);
608         CHECK_ACCESS(thing_ptr);
609         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
610         FREE(untag_ptr(thing));
611         BigEndianScalar_free(thing_conv);
612 }
613
614 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
615         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
616         switch(obj->tag) {
617                 case LDKBech32Error_MissingSeparator: return 0;
618                 case LDKBech32Error_InvalidChecksum: return 1;
619                 case LDKBech32Error_InvalidLength: return 2;
620                 case LDKBech32Error_InvalidChar: return 3;
621                 case LDKBech32Error_InvalidData: return 4;
622                 case LDKBech32Error_InvalidPadding: return 5;
623                 case LDKBech32Error_MixedCase: return 6;
624                 default: abort();
625         }
626 }
627 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
628         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
629         assert(obj->tag == LDKBech32Error_InvalidChar);
630                         int32_t invalid_char_conv = obj->invalid_char;
631         return invalid_char_conv;
632 }
633 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
634         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
635         assert(obj->tag == LDKBech32Error_InvalidData);
636                         int8_t invalid_data_conv = obj->invalid_data;
637         return invalid_data_conv;
638 }
639 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
640         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
641         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
642         return ret;
643 }
644 struct LDKWitness TxIn_get_witness (struct LDKTxIn* thing) {    return Witness_clone(&thing->witness);}int8_tArray  __attribute__((export_name("TS_TxIn_get_witness"))) TS_TxIn_get_witness(uint64_t thing) {
645         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
646         LDKWitness ret_var = TxIn_get_witness(thing_conv);
647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
649         Witness_free(ret_var);
650         return ret_arr;
651 }
652
653 struct LDKCVec_u8Z TxIn_get_script_sig (struct LDKTxIn* thing) {        return CVec_u8Z_clone(&thing->script_sig);}int8_tArray  __attribute__((export_name("TS_TxIn_get_script_sig"))) TS_TxIn_get_script_sig(uint64_t thing) {
654         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
655         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
656         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
657         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
658         CVec_u8Z_free(ret_var);
659         return ret_arr;
660 }
661
662 LDKThirtyTwoBytes TxIn_get_previous_txid (struct LDKTxIn* thing) {      return thing->previous_txid;}int8_tArray  __attribute__((export_name("TS_TxIn_get_previous_txid"))) TS_TxIn_get_previous_txid(uint64_t thing) {
663         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
664         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
665         memcpy(ret_arr->elems, TxIn_get_previous_txid(thing_conv).data, 32);
666         return ret_arr;
667 }
668
669 uint32_t TxIn_get_previous_vout (struct LDKTxIn* thing) {       return thing->previous_vout;}int32_t  __attribute__((export_name("TS_TxIn_get_previous_vout"))) TS_TxIn_get_previous_vout(uint64_t thing) {
670         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
671         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
672         return ret_conv;
673 }
674
675 uint32_t TxIn_get_sequence (struct LDKTxIn* thing) {    return thing->sequence;}int32_t  __attribute__((export_name("TS_TxIn_get_sequence"))) TS_TxIn_get_sequence(uint64_t thing) {
676         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
677         int32_t ret_conv = TxIn_get_sequence(thing_conv);
678         return ret_conv;
679 }
680
681 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {   return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t thing) {
682         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
683         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
684         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
685         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
686         CVec_u8Z_free(ret_var);
687         return ret_arr;
688 }
689
690 uint64_t TxOut_get_value (struct LDKTxOut* thing) {     return thing->value;}int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t thing) {
691         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
692         int64_t ret_conv = TxOut_get_value(thing_conv);
693         return ret_conv;
694 }
695
696 uint32_t __attribute__((export_name("TS_LDKCOption_DurationZ_ty_from_ptr"))) TS_LDKCOption_DurationZ_ty_from_ptr(uint64_t ptr) {
697         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
698         switch(obj->tag) {
699                 case LDKCOption_DurationZ_Some: return 0;
700                 case LDKCOption_DurationZ_None: return 1;
701                 default: abort();
702         }
703 }
704 int64_t __attribute__((export_name("TS_LDKCOption_DurationZ_Some_get_some"))) TS_LDKCOption_DurationZ_Some_get_some(uint64_t ptr) {
705         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
706         assert(obj->tag == LDKCOption_DurationZ_Some);
707                         int64_t some_conv = obj->some;
708         return some_conv;
709 }
710 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
711         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
712         for (size_t i = 0; i < ret.datalen; i++) {
713                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
714         }
715         return ret;
716 }
717 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
718         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
719         switch(obj->tag) {
720                 case LDKCOption_u64Z_Some: return 0;
721                 case LDKCOption_u64Z_None: return 1;
722                 default: abort();
723         }
724 }
725 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
726         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
727         assert(obj->tag == LDKCOption_u64Z_Some);
728                         int64_t some_conv = obj->some;
729         return some_conv;
730 }
731 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
732         LDKRefund ret = *owner->contents.result;
733         ret.is_owned = false;
734         return ret;
735 }
736 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
737         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
738         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
739         uint64_t ret_ref = 0;
740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
742         return ret_ref;
743 }
744
745 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
746         LDKBolt12ParseError ret = *owner->contents.err;
747         ret.is_owned = false;
748         return ret;
749 }
750 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
751         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
752         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
753         uint64_t ret_ref = 0;
754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
756         return ret_ref;
757 }
758
759 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
760         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
761         switch(obj->tag) {
762                 case LDKAPIError_APIMisuseError: return 0;
763                 case LDKAPIError_FeeRateTooHigh: return 1;
764                 case LDKAPIError_InvalidRoute: return 2;
765                 case LDKAPIError_ChannelUnavailable: return 3;
766                 case LDKAPIError_MonitorUpdateInProgress: return 4;
767                 case LDKAPIError_IncompatibleShutdownScript: return 5;
768                 default: abort();
769         }
770 }
771 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
772         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
773         assert(obj->tag == LDKAPIError_APIMisuseError);
774                         LDKStr err_str = obj->api_misuse_error.err;
775                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
776         return err_conv;
777 }
778 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
779         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
780         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
781                         LDKStr err_str = obj->fee_rate_too_high.err;
782                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
783         return err_conv;
784 }
785 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
786         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
787         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
788                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
789         return feerate_conv;
790 }
791 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
792         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
793         assert(obj->tag == LDKAPIError_InvalidRoute);
794                         LDKStr err_str = obj->invalid_route.err;
795                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
796         return err_conv;
797 }
798 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
799         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
800         assert(obj->tag == LDKAPIError_ChannelUnavailable);
801                         LDKStr err_str = obj->channel_unavailable.err;
802                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
803         return err_conv;
804 }
805 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
806         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
807         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
808                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
809                         uint64_t script_ref = 0;
810                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
811                         script_ref = tag_ptr(script_var.inner, false);
812         return script_ref;
813 }
814 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
815 CHECK(owner->result_ok);
816         return *owner->contents.result;
817 }
818 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
819         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
820         CResult_NoneAPIErrorZ_get_ok(owner_conv);
821 }
822
823 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
824 CHECK(!owner->result_ok);
825         return APIError_clone(&*owner->contents.err);
826 }
827 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
828         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
829         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
830         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
831         uint64_t ret_ref = tag_ptr(ret_copy, true);
832         return ret_ref;
833 }
834
835 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
836         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
837         for (size_t i = 0; i < ret.datalen; i++) {
838                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
839         }
840         return ret;
841 }
842 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
843         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
844         for (size_t i = 0; i < ret.datalen; i++) {
845                 ret.data[i] = APIError_clone(&orig->data[i]);
846         }
847         return ret;
848 }
849 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentSecretZ_ty_from_ptr"))) TS_LDKCOption_PaymentSecretZ_ty_from_ptr(uint64_t ptr) {
850         LDKCOption_PaymentSecretZ *obj = (LDKCOption_PaymentSecretZ*)untag_ptr(ptr);
851         switch(obj->tag) {
852                 case LDKCOption_PaymentSecretZ_Some: return 0;
853                 case LDKCOption_PaymentSecretZ_None: return 1;
854                 default: abort();
855         }
856 }
857 int8_tArray __attribute__((export_name("TS_LDKCOption_PaymentSecretZ_Some_get_some"))) TS_LDKCOption_PaymentSecretZ_Some_get_some(uint64_t ptr) {
858         LDKCOption_PaymentSecretZ *obj = (LDKCOption_PaymentSecretZ*)untag_ptr(ptr);
859         assert(obj->tag == LDKCOption_PaymentSecretZ_Some);
860                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
861                         memcpy(some_arr->elems, obj->some.data, 32);
862         return some_arr;
863 }
864 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
865         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
866         switch(obj->tag) {
867                 case LDKCOption_CVec_u8ZZ_Some: return 0;
868                 case LDKCOption_CVec_u8ZZ_None: return 1;
869                 default: abort();
870         }
871 }
872 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
873         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
874         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
875                         LDKCVec_u8Z some_var = obj->some;
876                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
877                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
878         return some_arr;
879 }
880 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
881         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
882         switch(obj->tag) {
883                 case LDKDecodeError_UnknownVersion: return 0;
884                 case LDKDecodeError_UnknownRequiredFeature: return 1;
885                 case LDKDecodeError_InvalidValue: return 2;
886                 case LDKDecodeError_ShortRead: return 3;
887                 case LDKDecodeError_BadLengthDescriptor: return 4;
888                 case LDKDecodeError_Io: return 5;
889                 case LDKDecodeError_UnsupportedCompression: return 6;
890                 default: abort();
891         }
892 }
893 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
894         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
895         assert(obj->tag == LDKDecodeError_Io);
896                         uint32_t io_conv = LDKIOError_to_js(obj->io);
897         return io_conv;
898 }
899 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
900         LDKRecipientOnionFields ret = *owner->contents.result;
901         ret.is_owned = false;
902         return ret;
903 }
904 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
905         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
906         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
907         uint64_t ret_ref = 0;
908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
910         return ret_ref;
911 }
912
913 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
914 CHECK(!owner->result_ok);
915         return DecodeError_clone(&*owner->contents.err);
916 }
917 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
918         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
919         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
920         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
921         uint64_t ret_ref = tag_ptr(ret_copy, true);
922         return ret_ref;
923 }
924
925 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
926         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
927         switch(obj->tag) {
928                 case LDKOffersMessage_InvoiceRequest: return 0;
929                 case LDKOffersMessage_Invoice: return 1;
930                 case LDKOffersMessage_InvoiceError: return 2;
931                 default: abort();
932         }
933 }
934 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
935         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
936         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
937                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
938                         uint64_t invoice_request_ref = 0;
939                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
940                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
941         return invoice_request_ref;
942 }
943 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
944         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
945         assert(obj->tag == LDKOffersMessage_Invoice);
946                         LDKBolt12Invoice invoice_var = obj->invoice;
947                         uint64_t invoice_ref = 0;
948                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
949                         invoice_ref = tag_ptr(invoice_var.inner, false);
950         return invoice_ref;
951 }
952 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
953         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
954         assert(obj->tag == LDKOffersMessage_InvoiceError);
955                         LDKInvoiceError invoice_error_var = obj->invoice_error;
956                         uint64_t invoice_error_ref = 0;
957                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
958                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
959         return invoice_error_ref;
960 }
961 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
962         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
963         switch(obj->tag) {
964                 case LDKCOption_OffersMessageZ_Some: return 0;
965                 case LDKCOption_OffersMessageZ_None: return 1;
966                 default: abort();
967         }
968 }
969 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
970         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
971         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
972                         uint64_t some_ref = tag_ptr(&obj->some, false);
973         return some_ref;
974 }
975 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
976 CHECK(owner->result_ok);
977         return OffersMessage_clone(&*owner->contents.result);
978 }
979 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
980         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
981         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
982         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
983         uint64_t ret_ref = tag_ptr(ret_copy, true);
984         return ret_ref;
985 }
986
987 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
988 CHECK(!owner->result_ok);
989         return DecodeError_clone(&*owner->contents.err);
990 }
991 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
992         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
993         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
994         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
995         uint64_t ret_ref = tag_ptr(ret_copy, true);
996         return ret_ref;
997 }
998
999 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
1000         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
1001         switch(obj->tag) {
1002                 case LDKCOption_HTLCClaimZ_Some: return 0;
1003                 case LDKCOption_HTLCClaimZ_None: return 1;
1004                 default: abort();
1005         }
1006 }
1007 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
1008         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
1009         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
1010                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
1011         return some_conv;
1012 }
1013 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1014 CHECK(owner->result_ok);
1015         return *owner->contents.result;
1016 }
1017 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1018         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1019         CResult_NoneNoneZ_get_ok(owner_conv);
1020 }
1021
1022 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1023 CHECK(!owner->result_ok);
1024         return *owner->contents.err;
1025 }
1026 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1027         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1028         CResult_NoneNoneZ_get_err(owner_conv);
1029 }
1030
1031 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1032         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
1033         ret.is_owned = false;
1034         return ret;
1035 }
1036 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
1037         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1038         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1039         uint64_t ret_ref = 0;
1040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1042         return ret_ref;
1043 }
1044
1045 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1046 CHECK(!owner->result_ok);
1047         return DecodeError_clone(&*owner->contents.err);
1048 }
1049 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
1050         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1051         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1052         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1053         uint64_t ret_ref = tag_ptr(ret_copy, true);
1054         return ret_ref;
1055 }
1056
1057 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1058         LDKTxCreationKeys ret = *owner->contents.result;
1059         ret.is_owned = false;
1060         return ret;
1061 }
1062 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
1063         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1064         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1065         uint64_t ret_ref = 0;
1066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1068         return ret_ref;
1069 }
1070
1071 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1072 CHECK(!owner->result_ok);
1073         return DecodeError_clone(&*owner->contents.err);
1074 }
1075 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
1076         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1077         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1078         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1079         uint64_t ret_ref = tag_ptr(ret_copy, true);
1080         return ret_ref;
1081 }
1082
1083 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1084         LDKChannelPublicKeys ret = *owner->contents.result;
1085         ret.is_owned = false;
1086         return ret;
1087 }
1088 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
1089         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1090         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1091         uint64_t ret_ref = 0;
1092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1094         return ret_ref;
1095 }
1096
1097 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1098 CHECK(!owner->result_ok);
1099         return DecodeError_clone(&*owner->contents.err);
1100 }
1101 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
1102         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1103         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1104         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1105         uint64_t ret_ref = tag_ptr(ret_copy, true);
1106         return ret_ref;
1107 }
1108
1109 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1110         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1111         switch(obj->tag) {
1112                 case LDKCOption_u32Z_Some: return 0;
1113                 case LDKCOption_u32Z_None: return 1;
1114                 default: abort();
1115         }
1116 }
1117 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1118         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1119         assert(obj->tag == LDKCOption_u32Z_Some);
1120                         int32_t some_conv = obj->some;
1121         return some_conv;
1122 }
1123 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1124         LDKHTLCOutputInCommitment ret = *owner->contents.result;
1125         ret.is_owned = false;
1126         return ret;
1127 }
1128 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
1129         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1130         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1131         uint64_t ret_ref = 0;
1132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1134         return ret_ref;
1135 }
1136
1137 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1138 CHECK(!owner->result_ok);
1139         return DecodeError_clone(&*owner->contents.err);
1140 }
1141 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
1142         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1143         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1144         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1145         uint64_t ret_ref = tag_ptr(ret_copy, true);
1146         return ret_ref;
1147 }
1148
1149 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentPreimageZ_ty_from_ptr"))) TS_LDKCOption_PaymentPreimageZ_ty_from_ptr(uint64_t ptr) {
1150         LDKCOption_PaymentPreimageZ *obj = (LDKCOption_PaymentPreimageZ*)untag_ptr(ptr);
1151         switch(obj->tag) {
1152                 case LDKCOption_PaymentPreimageZ_Some: return 0;
1153                 case LDKCOption_PaymentPreimageZ_None: return 1;
1154                 default: abort();
1155         }
1156 }
1157 int8_tArray __attribute__((export_name("TS_LDKCOption_PaymentPreimageZ_Some_get_some"))) TS_LDKCOption_PaymentPreimageZ_Some_get_some(uint64_t ptr) {
1158         LDKCOption_PaymentPreimageZ *obj = (LDKCOption_PaymentPreimageZ*)untag_ptr(ptr);
1159         assert(obj->tag == LDKCOption_PaymentPreimageZ_Some);
1160                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
1161                         memcpy(some_arr->elems, obj->some.data, 32);
1162         return some_arr;
1163 }
1164 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1165         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
1166         ret.is_owned = false;
1167         return ret;
1168 }
1169 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
1170         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1171         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1172         uint64_t ret_ref = 0;
1173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1175         return ret_ref;
1176 }
1177
1178 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1179 CHECK(!owner->result_ok);
1180         return DecodeError_clone(&*owner->contents.err);
1181 }
1182 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
1183         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1184         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1185         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1186         uint64_t ret_ref = tag_ptr(ret_copy, true);
1187         return ret_ref;
1188 }
1189
1190 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1191         LDKChannelTransactionParameters ret = *owner->contents.result;
1192         ret.is_owned = false;
1193         return ret;
1194 }
1195 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
1196         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1197         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1198         uint64_t ret_ref = 0;
1199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1201         return ret_ref;
1202 }
1203
1204 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1205 CHECK(!owner->result_ok);
1206         return DecodeError_clone(&*owner->contents.err);
1207 }
1208 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
1209         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1210         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1211         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1212         uint64_t ret_ref = tag_ptr(ret_copy, true);
1213         return ret_ref;
1214 }
1215
1216 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1217         LDKHolderCommitmentTransaction ret = *owner->contents.result;
1218         ret.is_owned = false;
1219         return ret;
1220 }
1221 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
1222         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1223         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1224         uint64_t ret_ref = 0;
1225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1227         return ret_ref;
1228 }
1229
1230 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1231 CHECK(!owner->result_ok);
1232         return DecodeError_clone(&*owner->contents.err);
1233 }
1234 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1235         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1236         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1237         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1238         uint64_t ret_ref = tag_ptr(ret_copy, true);
1239         return ret_ref;
1240 }
1241
1242 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1243         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
1244         ret.is_owned = false;
1245         return ret;
1246 }
1247 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
1248         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1249         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1250         uint64_t ret_ref = 0;
1251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1253         return ret_ref;
1254 }
1255
1256 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1257 CHECK(!owner->result_ok);
1258         return DecodeError_clone(&*owner->contents.err);
1259 }
1260 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1261         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1263         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1264         uint64_t ret_ref = tag_ptr(ret_copy, true);
1265         return ret_ref;
1266 }
1267
1268 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1269         LDKTrustedClosingTransaction ret = *owner->contents.result;
1270         ret.is_owned = false;
1271         return ret;
1272 }
1273 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
1274         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1275         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1276         uint64_t ret_ref = 0;
1277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1279         return ret_ref;
1280 }
1281
1282 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1283 CHECK(!owner->result_ok);
1284         return *owner->contents.err;
1285 }
1286 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
1287         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1288         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1289 }
1290
1291 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1292         LDKCommitmentTransaction ret = *owner->contents.result;
1293         ret.is_owned = false;
1294         return ret;
1295 }
1296 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
1297         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1298         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1299         uint64_t ret_ref = 0;
1300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1302         return ret_ref;
1303 }
1304
1305 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1306 CHECK(!owner->result_ok);
1307         return DecodeError_clone(&*owner->contents.err);
1308 }
1309 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1310         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1311         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1312         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1313         uint64_t ret_ref = tag_ptr(ret_copy, true);
1314         return ret_ref;
1315 }
1316
1317 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1318         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
1319         ret.is_owned = false;
1320         return ret;
1321 }
1322 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
1323         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1324         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1325         uint64_t ret_ref = 0;
1326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1328         return ret_ref;
1329 }
1330
1331 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1332 CHECK(!owner->result_ok);
1333         return *owner->contents.err;
1334 }
1335 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
1336         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1337         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1338 }
1339
1340 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1341 CHECK(owner->result_ok);
1342         return *owner->contents.result;
1343 }
1344 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
1345         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1346         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1347         ptrArray ret_arr = NULL;
1348         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1349         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1350         for (size_t m = 0; m < ret_var.datalen; m++) {
1351                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1352                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1353                 ret_arr_ptr[m] = ret_conv_12_arr;
1354         }
1355         
1356         return ret_arr;
1357 }
1358
1359 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1360 CHECK(!owner->result_ok);
1361         return *owner->contents.err;
1362 }
1363 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
1364         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1365         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1366 }
1367
1368 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1369         LDKShutdownScript ret = *owner->contents.result;
1370         ret.is_owned = false;
1371         return ret;
1372 }
1373 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1374         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1375         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1376         uint64_t ret_ref = 0;
1377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1379         return ret_ref;
1380 }
1381
1382 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1383 CHECK(!owner->result_ok);
1384         return DecodeError_clone(&*owner->contents.err);
1385 }
1386 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1387         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1388         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1389         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1390         uint64_t ret_ref = tag_ptr(ret_copy, true);
1391         return ret_ref;
1392 }
1393
1394 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1395         LDKShutdownScript ret = *owner->contents.result;
1396         ret.is_owned = false;
1397         return ret;
1398 }
1399 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1400         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1401         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1402         uint64_t ret_ref = 0;
1403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1405         return ret_ref;
1406 }
1407
1408 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1409         LDKInvalidShutdownScript ret = *owner->contents.err;
1410         ret.is_owned = false;
1411         return ret;
1412 }
1413 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1414         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1415         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1416         uint64_t ret_ref = 0;
1417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1419         return ret_ref;
1420 }
1421
1422 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1423         LDKBlindedPayInfo ret = *owner->contents.result;
1424         ret.is_owned = false;
1425         return ret;
1426 }
1427 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1428         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1429         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1430         uint64_t ret_ref = 0;
1431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1433         return ret_ref;
1434 }
1435
1436 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1437 CHECK(!owner->result_ok);
1438         return DecodeError_clone(&*owner->contents.err);
1439 }
1440 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1441         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1442         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1443         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1444         uint64_t ret_ref = tag_ptr(ret_copy, true);
1445         return ret_ref;
1446 }
1447
1448 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1449         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1450         ret.is_owned = false;
1451         return ret;
1452 }
1453 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1454         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1455         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1456         uint64_t ret_ref = 0;
1457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1459         return ret_ref;
1460 }
1461
1462 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1463 CHECK(!owner->result_ok);
1464         return DecodeError_clone(&*owner->contents.err);
1465 }
1466 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1467         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1468         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1469         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1470         uint64_t ret_ref = tag_ptr(ret_copy, true);
1471         return ret_ref;
1472 }
1473
1474 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1475         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1476         ret.is_owned = false;
1477         return ret;
1478 }
1479 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1480         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1481         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1482         uint64_t ret_ref = 0;
1483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1485         return ret_ref;
1486 }
1487
1488 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1489 CHECK(!owner->result_ok);
1490         return DecodeError_clone(&*owner->contents.err);
1491 }
1492 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1493         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1494         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1495         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1496         uint64_t ret_ref = tag_ptr(ret_copy, true);
1497         return ret_ref;
1498 }
1499
1500 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1501         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1502         switch(obj->tag) {
1503                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1504                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1505                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1506                 default: abort();
1507         }
1508 }
1509 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1510         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1511         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1512                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1513                         uint64_t outpoint_ref = 0;
1514                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1515                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1516         return outpoint_ref;
1517 }
1518 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1519         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1520         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1521                         LDKTxOut* output_ref = &obj->static_output.output;
1522         return tag_ptr(output_ref, false);
1523 }
1524 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1525         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1526         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1527                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1528                         uint64_t delayed_payment_output_ref = 0;
1529                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1530                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1531         return delayed_payment_output_ref;
1532 }
1533 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1534         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1535         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1536                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1537                         uint64_t static_payment_output_ref = 0;
1538                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1539                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1540         return static_payment_output_ref;
1541 }
1542 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1543 CHECK(owner->result_ok);
1544         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1545 }
1546 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1547         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1548         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1549         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1550         uint64_t ret_ref = tag_ptr(ret_copy, true);
1551         return ret_ref;
1552 }
1553
1554 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1555 CHECK(!owner->result_ok);
1556         return DecodeError_clone(&*owner->contents.err);
1557 }
1558 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1559         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1561         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1562         uint64_t ret_ref = tag_ptr(ret_copy, true);
1563         return ret_ref;
1564 }
1565
1566 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1567         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1568         for (size_t i = 0; i < ret.datalen; i++) {
1569                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1570         }
1571         return ret;
1572 }
1573 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1574         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1575         for (size_t i = 0; i < ret.datalen; i++) {
1576                 ret.data[i] = TxOut_clone(&orig->data[i]);
1577         }
1578         return ret;
1579 }
1580 uint32_t __attribute__((export_name("TS_LDKCOption_PackedLockTimeZ_ty_from_ptr"))) TS_LDKCOption_PackedLockTimeZ_ty_from_ptr(uint64_t ptr) {
1581         LDKCOption_PackedLockTimeZ *obj = (LDKCOption_PackedLockTimeZ*)untag_ptr(ptr);
1582         switch(obj->tag) {
1583                 case LDKCOption_PackedLockTimeZ_Some: return 0;
1584                 case LDKCOption_PackedLockTimeZ_None: return 1;
1585                 default: abort();
1586         }
1587 }
1588 int32_t __attribute__((export_name("TS_LDKCOption_PackedLockTimeZ_Some_get_some"))) TS_LDKCOption_PackedLockTimeZ_Some_get_some(uint64_t ptr) {
1589         LDKCOption_PackedLockTimeZ *obj = (LDKCOption_PackedLockTimeZ*)untag_ptr(ptr);
1590         assert(obj->tag == LDKCOption_PackedLockTimeZ_Some);
1591                         int32_t some_conv = obj->some;
1592         return some_conv;
1593 }
1594 static inline struct LDKCVec_u8Z C2Tuple_PartiallySignedTransactionusizeZ_get_a(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR owner){
1595         return CVec_u8Z_clone(&owner->a);
1596 }
1597 int8_tArray  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_get_a"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_get_a(uint64_t owner) {
1598         LDKC2Tuple_PartiallySignedTransactionusizeZ* owner_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(owner);
1599         LDKCVec_u8Z ret_var = C2Tuple_PartiallySignedTransactionusizeZ_get_a(owner_conv);
1600         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1601         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1602         CVec_u8Z_free(ret_var);
1603         return ret_arr;
1604 }
1605
1606 static inline uintptr_t C2Tuple_PartiallySignedTransactionusizeZ_get_b(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR owner){
1607         return owner->b;
1608 }
1609 uint32_t  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_get_b"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_get_b(uint64_t owner) {
1610         LDKC2Tuple_PartiallySignedTransactionusizeZ* owner_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(owner);
1611         uint32_t ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_get_b(owner_conv);
1612         return ret_conv;
1613 }
1614
1615 static inline struct LDKC2Tuple_PartiallySignedTransactionusizeZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR owner){
1616 CHECK(owner->result_ok);
1617         return C2Tuple_PartiallySignedTransactionusizeZ_clone(&*owner->contents.result);
1618 }
1619 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(uint64_t owner) {
1620         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(owner);
1621         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
1622         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(owner_conv);
1623         return tag_ptr(ret_conv, true);
1624 }
1625
1626 static inline void CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR owner){
1627 CHECK(!owner->result_ok);
1628         return *owner->contents.err;
1629 }
1630 void  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(uint64_t owner) {
1631         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(owner);
1632         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(owner_conv);
1633 }
1634
1635 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
1636         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
1637         for (size_t i = 0; i < ret.datalen; i++) {
1638                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1639         }
1640         return ret;
1641 }
1642 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1643         return owner->a;
1644 }
1645 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
1646         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
1647         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1648         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
1649         return ret_arr;
1650 }
1651
1652 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1653         return owner->b;
1654 }
1655 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
1656         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
1657         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
1658         ptrArray ret_arr = NULL;
1659         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1660         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1661         for (size_t m = 0; m < ret_var.datalen; m++) {
1662                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1663                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1664                 ret_arr_ptr[m] = ret_conv_12_arr;
1665         }
1666         
1667         return ret_arr;
1668 }
1669
1670 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1671 CHECK(owner->result_ok);
1672         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
1673 }
1674 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
1675         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
1676         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1677         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
1678         return tag_ptr(ret_conv, true);
1679 }
1680
1681 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1682 CHECK(!owner->result_ok);
1683         return *owner->contents.err;
1684 }
1685 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
1686         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
1687         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
1688 }
1689
1690 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1691 CHECK(owner->result_ok);
1692         return *owner->contents.result;
1693 }
1694 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
1695         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
1696         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1697         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1698         return ret_arr;
1699 }
1700
1701 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1702 CHECK(!owner->result_ok);
1703         return *owner->contents.err;
1704 }
1705 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
1706         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
1707         CResult_SignatureNoneZ_get_err(owner_conv);
1708 }
1709
1710 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1711 CHECK(owner->result_ok);
1712         return *owner->contents.result;
1713 }
1714 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1715         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1716         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1717         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1718         return ret_arr;
1719 }
1720
1721 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1722 CHECK(!owner->result_ok);
1723         return *owner->contents.err;
1724 }
1725 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1726         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1727         CResult_PublicKeyNoneZ_get_err(owner_conv);
1728 }
1729
1730 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
1731         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
1732         switch(obj->tag) {
1733                 case LDKCOption_ScalarZ_Some: return 0;
1734                 case LDKCOption_ScalarZ_None: return 1;
1735                 default: abort();
1736         }
1737 }
1738 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
1739         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
1740         assert(obj->tag == LDKCOption_ScalarZ_Some);
1741                         LDKBigEndianScalar* some_ref = &obj->some;
1742         return tag_ptr(some_ref, false);
1743 }
1744 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
1745 CHECK(owner->result_ok);
1746         return ThirtyTwoBytes_clone(&*owner->contents.result);
1747 }
1748 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
1749         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
1750         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1751         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
1752         return ret_arr;
1753 }
1754
1755 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
1756 CHECK(!owner->result_ok);
1757         return *owner->contents.err;
1758 }
1759 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
1760         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
1761         CResult_SharedSecretNoneZ_get_err(owner_conv);
1762 }
1763
1764 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1765 CHECK(owner->result_ok);
1766         return *owner->contents.result;
1767 }
1768 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1769         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1770         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1771         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1772         return ret_arr;
1773 }
1774
1775 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1776 CHECK(!owner->result_ok);
1777         return *owner->contents.err;
1778 }
1779 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1780         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1781         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1782 }
1783
1784 typedef struct LDKChannelSigner_JCalls {
1785         atomic_size_t refcnt;
1786         uint32_t instance_ptr;
1787 } LDKChannelSigner_JCalls;
1788 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1789         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1790         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1791                 FREE(j_calls);
1792         }
1793 }
1794 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1795         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1796         int64_t idx_conv = idx;
1797         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1798         LDKPublicKey ret_ref;
1799         CHECK(ret->arr_len == 33);
1800         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1801         return ret_ref;
1802 }
1803 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1804         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1805         int64_t idx_conv = idx;
1806         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1807         LDKThirtyTwoBytes ret_ref;
1808         CHECK(ret->arr_len == 32);
1809         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1810         return ret_ref;
1811 }
1812 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
1813         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1814         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1815         uint64_t holder_tx_ref = 0;
1816         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1817         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1818         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1819         LDKCVec_PaymentPreimageZ preimages_var = preimages;
1820         ptrArray preimages_arr = NULL;
1821         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1822         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1823         for (size_t m = 0; m < preimages_var.datalen; m++) {
1824                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1825                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1826                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1827         }
1828         
1829         FREE(preimages_var.data);
1830         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 2, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1831         void* ret_ptr = untag_ptr(ret);
1832         CHECK_ACCESS(ret_ptr);
1833         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1834         FREE(untag_ptr(ret));
1835         return ret_conv;
1836 }
1837 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1838         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1839         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 3, 0, 0, 0, 0, 0, 0);
1840         LDKThirtyTwoBytes ret_ref;
1841         CHECK(ret->arr_len == 32);
1842         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1843         return ret_ref;
1844 }
1845 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1846         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1847         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1848         uint64_t channel_parameters_ref = 0;
1849         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1850         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1851         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1852         js_invoke_function_buuuuu(j_calls->instance_ptr, 4, channel_parameters_ref, 0, 0, 0, 0, 0);
1853 }
1854 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1855         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1856         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1857 }
1858 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1859         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1860         atomic_init(&calls->refcnt, 1);
1861         calls->instance_ptr = o;
1862
1863         LDKChannelPublicKeys pubkeys_conv;
1864         pubkeys_conv.inner = untag_ptr(pubkeys);
1865         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1866         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1867
1868         LDKChannelSigner ret = {
1869                 .this_arg = (void*) calls,
1870                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1871                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1872                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1873                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1874                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1875                 .free = LDKChannelSigner_JCalls_free,
1876                 .pubkeys = pubkeys_conv,
1877                 .set_pubkeys = NULL,
1878         };
1879         return ret;
1880 }
1881 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1882         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1883         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1884         return tag_ptr(res_ptr, true);
1885 }
1886 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1887         void* this_arg_ptr = untag_ptr(this_arg);
1888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1889         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1890         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1891         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1892         return ret_arr;
1893 }
1894
1895 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1896         void* this_arg_ptr = untag_ptr(this_arg);
1897         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1898         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1899         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1900         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1901         return ret_arr;
1902 }
1903
1904 uint64_t  __attribute__((export_name("TS_ChannelSigner_validate_holder_commitment"))) TS_ChannelSigner_validate_holder_commitment(uint64_t this_arg, uint64_t holder_tx, ptrArray preimages) {
1905         void* this_arg_ptr = untag_ptr(this_arg);
1906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1907         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1908         LDKHolderCommitmentTransaction holder_tx_conv;
1909         holder_tx_conv.inner = untag_ptr(holder_tx);
1910         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1911         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1912         holder_tx_conv.is_owned = false;
1913         LDKCVec_PaymentPreimageZ preimages_constr;
1914         preimages_constr.datalen = preimages->arr_len;
1915         if (preimages_constr.datalen > 0)
1916                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
1917         else
1918                 preimages_constr.data = NULL;
1919         int8_tArray* preimages_vals = (void*) preimages->elems;
1920         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1921                 int8_tArray preimages_conv_12 = preimages_vals[m];
1922                 LDKThirtyTwoBytes preimages_conv_12_ref;
1923                 CHECK(preimages_conv_12->arr_len == 32);
1924                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1925                 preimages_constr.data[m] = preimages_conv_12_ref;
1926         }
1927         FREE(preimages);
1928         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1929         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
1930         return tag_ptr(ret_conv, true);
1931 }
1932
1933 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1934         void* this_arg_ptr = untag_ptr(this_arg);
1935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1936         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1937         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1938         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1939         return ret_arr;
1940 }
1941
1942 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1943         void* this_arg_ptr = untag_ptr(this_arg);
1944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1945         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1946         LDKChannelTransactionParameters channel_parameters_conv;
1947         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1948         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1949         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1950         channel_parameters_conv.is_owned = false;
1951         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1952 }
1953
1954 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1955         if (this_arg->set_pubkeys != NULL)
1956                 this_arg->set_pubkeys(this_arg);
1957         return this_arg->pubkeys;
1958 }
1959 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1960         void* this_arg_ptr = untag_ptr(this_arg);
1961         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1962         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1963         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1964         uint64_t ret_ref = 0;
1965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1967         return ret_ref;
1968 }
1969
1970 typedef struct LDKEcdsaChannelSigner_JCalls {
1971         atomic_size_t refcnt;
1972         uint32_t instance_ptr;
1973         LDKChannelSigner_JCalls* ChannelSigner;
1974 } LDKEcdsaChannelSigner_JCalls;
1975 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1976         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1977         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1978                 FREE(j_calls);
1979         }
1980 }
1981 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
1982         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1983         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1984         uint64_t commitment_tx_ref = 0;
1985         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1986         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1987         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1988         LDKCVec_PaymentPreimageZ preimages_var = preimages;
1989         ptrArray preimages_arr = NULL;
1990         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1991         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1992         for (size_t m = 0; m < preimages_var.datalen; m++) {
1993                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1994                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1995                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1996         }
1997         
1998         FREE(preimages_var.data);
1999         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 5, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
2000         void* ret_ptr = untag_ptr(ret);
2001         CHECK_ACCESS(ret_ptr);
2002         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2003         FREE(untag_ptr(ret));
2004         return ret_conv;
2005 }
2006 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2007         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2008         int64_t idx_conv = idx;
2009         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
2010         memcpy(secret_arr->elems, *secret, 32);
2011         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
2012         void* ret_ptr = untag_ptr(ret);
2013         CHECK_ACCESS(ret_ptr);
2014         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2015         FREE(untag_ptr(ret));
2016         return ret_conv;
2017 }
2018 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2019         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2020         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2021         uint64_t commitment_tx_ref = 0;
2022         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2023         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2024         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2025         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
2026         void* ret_ptr = untag_ptr(ret);
2027         CHECK_ACCESS(ret_ptr);
2028         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2029         FREE(untag_ptr(ret));
2030         return ret_conv;
2031 }
2032 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
2033         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2034         LDKTransaction justice_tx_var = justice_tx;
2035         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2036         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2037         Transaction_free(justice_tx_var);
2038         uint32_t input_conv = input;
2039         int64_t amount_conv = amount;
2040         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2041         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2042         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);
2043         void* ret_ptr = untag_ptr(ret);
2044         CHECK_ACCESS(ret_ptr);
2045         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2046         FREE(untag_ptr(ret));
2047         return ret_conv;
2048 }
2049 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2050         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2051         LDKTransaction justice_tx_var = justice_tx;
2052         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2053         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2054         Transaction_free(justice_tx_var);
2055         uint32_t input_conv = input;
2056         int64_t amount_conv = amount;
2057         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2058         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2059         LDKHTLCOutputInCommitment htlc_var = *htlc;
2060         uint64_t htlc_ref = 0;
2061         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2062         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2063         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2064         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);
2065         void* ret_ptr = untag_ptr(ret);
2066         CHECK_ACCESS(ret_ptr);
2067         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2068         FREE(untag_ptr(ret));
2069         return ret_conv;
2070 }
2071 LDKCResult_SignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
2072         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2073         LDKTransaction htlc_tx_var = htlc_tx;
2074         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2075         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2076         Transaction_free(htlc_tx_var);
2077         uint32_t input_conv = input;
2078         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
2079         uint64_t htlc_descriptor_ref = 0;
2080         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
2081         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
2082         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
2083         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);
2084         void* ret_ptr = untag_ptr(ret);
2085         CHECK_ACCESS(ret_ptr);
2086         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2087         FREE(untag_ptr(ret));
2088         return ret_conv;
2089 }
2090 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2091         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2092         LDKTransaction htlc_tx_var = htlc_tx;
2093         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2094         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2095         Transaction_free(htlc_tx_var);
2096         uint32_t input_conv = input;
2097         int64_t amount_conv = amount;
2098         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2099         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2100         LDKHTLCOutputInCommitment htlc_var = *htlc;
2101         uint64_t htlc_ref = 0;
2102         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2103         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2104         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2105         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);
2106         void* ret_ptr = untag_ptr(ret);
2107         CHECK_ACCESS(ret_ptr);
2108         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2109         FREE(untag_ptr(ret));
2110         return ret_conv;
2111 }
2112 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2113         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2114         LDKClosingTransaction closing_tx_var = *closing_tx;
2115         uint64_t closing_tx_ref = 0;
2116         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2117         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2118         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2119         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
2120         void* ret_ptr = untag_ptr(ret);
2121         CHECK_ACCESS(ret_ptr);
2122         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2123         FREE(untag_ptr(ret));
2124         return ret_conv;
2125 }
2126 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2127         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2128         LDKTransaction anchor_tx_var = anchor_tx;
2129         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2130         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2131         Transaction_free(anchor_tx_var);
2132         uint32_t input_conv = input;
2133         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
2134         void* ret_ptr = untag_ptr(ret);
2135         CHECK_ACCESS(ret_ptr);
2136         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2137         FREE(untag_ptr(ret));
2138         return ret_conv;
2139 }
2140 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2141         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2142         LDKUnsignedChannelAnnouncement msg_var = *msg;
2143         uint64_t msg_ref = 0;
2144         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2145         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2146         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2147         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
2148         void* ret_ptr = untag_ptr(ret);
2149         CHECK_ACCESS(ret_ptr);
2150         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2151         FREE(untag_ptr(ret));
2152         return ret_conv;
2153 }
2154 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2155         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2156         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2157         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2158 }
2159 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2160         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2161         atomic_init(&calls->refcnt, 1);
2162         calls->instance_ptr = o;
2163
2164         LDKChannelPublicKeys pubkeys_conv;
2165         pubkeys_conv.inner = untag_ptr(pubkeys);
2166         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2167         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2168
2169         LDKEcdsaChannelSigner ret = {
2170                 .this_arg = (void*) calls,
2171                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2172                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
2173                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
2174                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2175                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2176                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2177                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2178                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2179                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2180                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2181                 .free = LDKEcdsaChannelSigner_JCalls_free,
2182                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2183         };
2184         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2185         return ret;
2186 }
2187 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2188         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2189         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2190         return tag_ptr(res_ptr, true);
2191 }
2192 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_counterparty_commitment"))) TS_EcdsaChannelSigner_sign_counterparty_commitment(uint64_t this_arg, uint64_t commitment_tx, ptrArray preimages) {
2193         void* this_arg_ptr = untag_ptr(this_arg);
2194         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2195         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2196         LDKCommitmentTransaction commitment_tx_conv;
2197         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2198         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2199         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2200         commitment_tx_conv.is_owned = false;
2201         LDKCVec_PaymentPreimageZ preimages_constr;
2202         preimages_constr.datalen = preimages->arr_len;
2203         if (preimages_constr.datalen > 0)
2204                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
2205         else
2206                 preimages_constr.data = NULL;
2207         int8_tArray* preimages_vals = (void*) preimages->elems;
2208         for (size_t m = 0; m < preimages_constr.datalen; m++) {
2209                 int8_tArray preimages_conv_12 = preimages_vals[m];
2210                 LDKThirtyTwoBytes preimages_conv_12_ref;
2211                 CHECK(preimages_conv_12->arr_len == 32);
2212                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
2213                 preimages_constr.data[m] = preimages_conv_12_ref;
2214         }
2215         FREE(preimages);
2216         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2217         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
2218         return tag_ptr(ret_conv, true);
2219 }
2220
2221 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_validate_counterparty_revocation"))) TS_EcdsaChannelSigner_validate_counterparty_revocation(uint64_t this_arg, int64_t idx, int8_tArray secret) {
2222         void* this_arg_ptr = untag_ptr(this_arg);
2223         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2224         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2225         uint8_t secret_arr[32];
2226         CHECK(secret->arr_len == 32);
2227         memcpy(secret_arr, secret->elems, 32); FREE(secret);
2228         uint8_t (*secret_ref)[32] = &secret_arr;
2229         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2230         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2231         return tag_ptr(ret_conv, true);
2232 }
2233
2234 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment_and_htlcs"))) TS_EcdsaChannelSigner_sign_holder_commitment_and_htlcs(uint64_t this_arg, uint64_t commitment_tx) {
2235         void* this_arg_ptr = untag_ptr(this_arg);
2236         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2237         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2238         LDKHolderCommitmentTransaction commitment_tx_conv;
2239         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2240         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2241         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2242         commitment_tx_conv.is_owned = false;
2243         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2244         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2245         return tag_ptr(ret_conv, true);
2246 }
2247
2248 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) {
2249         void* this_arg_ptr = untag_ptr(this_arg);
2250         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2251         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2252         LDKTransaction justice_tx_ref;
2253         justice_tx_ref.datalen = justice_tx->arr_len;
2254         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2255         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2256         justice_tx_ref.data_is_owned = true;
2257         uint8_t per_commitment_key_arr[32];
2258         CHECK(per_commitment_key->arr_len == 32);
2259         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2260         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2261         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2262         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2263         return tag_ptr(ret_conv, true);
2264 }
2265
2266 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) {
2267         void* this_arg_ptr = untag_ptr(this_arg);
2268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2269         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2270         LDKTransaction justice_tx_ref;
2271         justice_tx_ref.datalen = justice_tx->arr_len;
2272         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2273         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2274         justice_tx_ref.data_is_owned = true;
2275         uint8_t per_commitment_key_arr[32];
2276         CHECK(per_commitment_key->arr_len == 32);
2277         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2278         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2279         LDKHTLCOutputInCommitment htlc_conv;
2280         htlc_conv.inner = untag_ptr(htlc);
2281         htlc_conv.is_owned = ptr_is_owned(htlc);
2282         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2283         htlc_conv.is_owned = false;
2284         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2285         *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);
2286         return tag_ptr(ret_conv, true);
2287 }
2288
2289 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) {
2290         void* this_arg_ptr = untag_ptr(this_arg);
2291         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2292         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2293         LDKTransaction htlc_tx_ref;
2294         htlc_tx_ref.datalen = htlc_tx->arr_len;
2295         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2296         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2297         htlc_tx_ref.data_is_owned = true;
2298         LDKHTLCDescriptor htlc_descriptor_conv;
2299         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2300         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2301         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2302         htlc_descriptor_conv.is_owned = false;
2303         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2304         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2305         return tag_ptr(ret_conv, true);
2306 }
2307
2308 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) {
2309         void* this_arg_ptr = untag_ptr(this_arg);
2310         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2311         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2312         LDKTransaction htlc_tx_ref;
2313         htlc_tx_ref.datalen = htlc_tx->arr_len;
2314         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2315         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2316         htlc_tx_ref.data_is_owned = true;
2317         LDKPublicKey per_commitment_point_ref;
2318         CHECK(per_commitment_point->arr_len == 33);
2319         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2320         LDKHTLCOutputInCommitment htlc_conv;
2321         htlc_conv.inner = untag_ptr(htlc);
2322         htlc_conv.is_owned = ptr_is_owned(htlc);
2323         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2324         htlc_conv.is_owned = false;
2325         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2326         *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);
2327         return tag_ptr(ret_conv, true);
2328 }
2329
2330 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2331         void* this_arg_ptr = untag_ptr(this_arg);
2332         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2333         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2334         LDKClosingTransaction closing_tx_conv;
2335         closing_tx_conv.inner = untag_ptr(closing_tx);
2336         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2337         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2338         closing_tx_conv.is_owned = false;
2339         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2340         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2341         return tag_ptr(ret_conv, true);
2342 }
2343
2344 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) {
2345         void* this_arg_ptr = untag_ptr(this_arg);
2346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2347         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2348         LDKTransaction anchor_tx_ref;
2349         anchor_tx_ref.datalen = anchor_tx->arr_len;
2350         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2351         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2352         anchor_tx_ref.data_is_owned = true;
2353         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2354         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2355         return tag_ptr(ret_conv, true);
2356 }
2357
2358 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) {
2359         void* this_arg_ptr = untag_ptr(this_arg);
2360         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2361         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2362         LDKUnsignedChannelAnnouncement msg_conv;
2363         msg_conv.inner = untag_ptr(msg);
2364         msg_conv.is_owned = ptr_is_owned(msg);
2365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2366         msg_conv.is_owned = false;
2367         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2368         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2369         return tag_ptr(ret_conv, true);
2370 }
2371
2372 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2373         atomic_size_t refcnt;
2374         uint32_t instance_ptr;
2375         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2376         LDKChannelSigner_JCalls* ChannelSigner;
2377 } LDKWriteableEcdsaChannelSigner_JCalls;
2378 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2379         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2380         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2381                 FREE(j_calls);
2382         }
2383 }
2384 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2385         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2386         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2387         LDKCVec_u8Z ret_ref;
2388         ret_ref.datalen = ret->arr_len;
2389         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2390         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2391         return ret_ref;
2392 }
2393 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2394         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2395         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2396         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2397         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2398 }
2399 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2400         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2401         atomic_init(&calls->refcnt, 1);
2402         calls->instance_ptr = o;
2403
2404         LDKChannelPublicKeys pubkeys_conv;
2405         pubkeys_conv.inner = untag_ptr(pubkeys);
2406         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2407         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2408
2409         LDKWriteableEcdsaChannelSigner ret = {
2410                 .this_arg = (void*) calls,
2411                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2412                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2413                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2414                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2415         };
2416         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2417         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2418         return ret;
2419 }
2420 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2421         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2422         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2423         return tag_ptr(res_ptr, true);
2424 }
2425 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2426         void* this_arg_ptr = untag_ptr(this_arg);
2427         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2428         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2429         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2430         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2431         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2432         CVec_u8Z_free(ret_var);
2433         return ret_arr;
2434 }
2435
2436 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2437 CHECK(owner->result_ok);
2438         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2439 }
2440 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2441         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2442         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2443         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2444         return tag_ptr(ret_ret, true);
2445 }
2446
2447 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2448 CHECK(!owner->result_ok);
2449         return DecodeError_clone(&*owner->contents.err);
2450 }
2451 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2452         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2453         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2454         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2455         uint64_t ret_ref = tag_ptr(ret_copy, true);
2456         return ret_ref;
2457 }
2458
2459 static inline struct LDKCVec_u8Z CResult_ScriptNoneZ_get_ok(LDKCResult_ScriptNoneZ *NONNULL_PTR owner){
2460 CHECK(owner->result_ok);
2461         return CVec_u8Z_clone(&*owner->contents.result);
2462 }
2463 int8_tArray  __attribute__((export_name("TS_CResult_ScriptNoneZ_get_ok"))) TS_CResult_ScriptNoneZ_get_ok(uint64_t owner) {
2464         LDKCResult_ScriptNoneZ* owner_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(owner);
2465         LDKCVec_u8Z ret_var = CResult_ScriptNoneZ_get_ok(owner_conv);
2466         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2467         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2468         CVec_u8Z_free(ret_var);
2469         return ret_arr;
2470 }
2471
2472 static inline void CResult_ScriptNoneZ_get_err(LDKCResult_ScriptNoneZ *NONNULL_PTR owner){
2473 CHECK(!owner->result_ok);
2474         return *owner->contents.err;
2475 }
2476 void  __attribute__((export_name("TS_CResult_ScriptNoneZ_get_err"))) TS_CResult_ScriptNoneZ_get_err(uint64_t owner) {
2477         LDKCResult_ScriptNoneZ* owner_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(owner);
2478         CResult_ScriptNoneZ_get_err(owner_conv);
2479 }
2480
2481 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2482         LDKShutdownScript ret = *owner->contents.result;
2483         ret.is_owned = false;
2484         return ret;
2485 }
2486 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2487         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2488         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2489         uint64_t ret_ref = 0;
2490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2492         return ret_ref;
2493 }
2494
2495 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2496 CHECK(!owner->result_ok);
2497         return *owner->contents.err;
2498 }
2499 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2500         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2501         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2502 }
2503
2504 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2505         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2506         for (size_t i = 0; i < ret.datalen; i++) {
2507                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2508         }
2509         return ret;
2510 }
2511 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2512 CHECK(owner->result_ok);
2513         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
2514 }
2515 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
2516         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2517         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
2518         ptrArray ret_arr = NULL;
2519         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
2520         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
2521         for (size_t m = 0; m < ret_var.datalen; m++) {
2522                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
2523                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
2524                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
2525                 CVec_u8Z_free(ret_conv_12_var);
2526                 ret_arr_ptr[m] = ret_conv_12_arr;
2527         }
2528         
2529         FREE(ret_var.data);
2530         return ret_arr;
2531 }
2532
2533 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2534 CHECK(!owner->result_ok);
2535         return *owner->contents.err;
2536 }
2537 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
2538         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2539         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
2540 }
2541
2542 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2543         LDKInMemorySigner ret = *owner->contents.result;
2544         ret.is_owned = false;
2545         return ret;
2546 }
2547 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2548         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2549         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2550         uint64_t ret_ref = 0;
2551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2553         return ret_ref;
2554 }
2555
2556 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2557 CHECK(!owner->result_ok);
2558         return DecodeError_clone(&*owner->contents.err);
2559 }
2560 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2561         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2562         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2563         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2564         uint64_t ret_ref = tag_ptr(ret_copy, true);
2565         return ret_ref;
2566 }
2567
2568 static inline struct LDKCVec_u8Z CResult_PartiallySignedTransactionNoneZ_get_ok(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR owner){
2569 CHECK(owner->result_ok);
2570         return CVec_u8Z_clone(&*owner->contents.result);
2571 }
2572 int8_tArray  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_get_ok"))) TS_CResult_PartiallySignedTransactionNoneZ_get_ok(uint64_t owner) {
2573         LDKCResult_PartiallySignedTransactionNoneZ* owner_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(owner);
2574         LDKCVec_u8Z ret_var = CResult_PartiallySignedTransactionNoneZ_get_ok(owner_conv);
2575         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2576         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2577         CVec_u8Z_free(ret_var);
2578         return ret_arr;
2579 }
2580
2581 static inline void CResult_PartiallySignedTransactionNoneZ_get_err(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR owner){
2582 CHECK(!owner->result_ok);
2583         return *owner->contents.err;
2584 }
2585 void  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_get_err"))) TS_CResult_PartiallySignedTransactionNoneZ_get_err(uint64_t owner) {
2586         LDKCResult_PartiallySignedTransactionNoneZ* owner_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(owner);
2587         CResult_PartiallySignedTransactionNoneZ_get_err(owner_conv);
2588 }
2589
2590 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2591 CHECK(owner->result_ok);
2592         return *owner->contents.result;
2593 }
2594 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
2595         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2596         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2597         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2598         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2599         return ret_arr;
2600 }
2601
2602 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2603 CHECK(!owner->result_ok);
2604         return *owner->contents.err;
2605 }
2606 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
2607         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2608         CResult_TransactionNoneZ_get_err(owner_conv);
2609 }
2610
2611 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2612         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2613         for (size_t i = 0; i < ret.datalen; i++) {
2614                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2615         }
2616         return ret;
2617 }
2618 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2619         LDKRoute ret = *owner->contents.result;
2620         ret.is_owned = false;
2621         return ret;
2622 }
2623 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2624         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2625         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2626         uint64_t ret_ref = 0;
2627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2629         return ret_ref;
2630 }
2631
2632 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2633         LDKLightningError ret = *owner->contents.err;
2634         ret.is_owned = false;
2635         return ret;
2636 }
2637 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2638         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2639         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2640         uint64_t ret_ref = 0;
2641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2643         return ret_ref;
2644 }
2645
2646 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2647         LDKInFlightHtlcs ret = *owner->contents.result;
2648         ret.is_owned = false;
2649         return ret;
2650 }
2651 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2652         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2653         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2654         uint64_t ret_ref = 0;
2655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2657         return ret_ref;
2658 }
2659
2660 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2661 CHECK(!owner->result_ok);
2662         return DecodeError_clone(&*owner->contents.err);
2663 }
2664 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2665         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2666         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2667         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2668         uint64_t ret_ref = tag_ptr(ret_copy, true);
2669         return ret_ref;
2670 }
2671
2672 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2673         LDKRouteHop ret = *owner->contents.result;
2674         ret.is_owned = false;
2675         return ret;
2676 }
2677 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2678         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2679         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2680         uint64_t ret_ref = 0;
2681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2683         return ret_ref;
2684 }
2685
2686 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2687 CHECK(!owner->result_ok);
2688         return DecodeError_clone(&*owner->contents.err);
2689 }
2690 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2691         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2692         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2693         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2694         uint64_t ret_ref = tag_ptr(ret_copy, true);
2695         return ret_ref;
2696 }
2697
2698 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2699         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2700         for (size_t i = 0; i < ret.datalen; i++) {
2701                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2702         }
2703         return ret;
2704 }
2705 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2706         LDKBlindedTail ret = *owner->contents.result;
2707         ret.is_owned = false;
2708         return ret;
2709 }
2710 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2711         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2712         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2713         uint64_t ret_ref = 0;
2714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2716         return ret_ref;
2717 }
2718
2719 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2720 CHECK(!owner->result_ok);
2721         return DecodeError_clone(&*owner->contents.err);
2722 }
2723 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2724         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2725         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2726         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2727         uint64_t ret_ref = tag_ptr(ret_copy, true);
2728         return ret_ref;
2729 }
2730
2731 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2732         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2733         for (size_t i = 0; i < ret.datalen; i++) {
2734                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2735         }
2736         return ret;
2737 }
2738 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2739         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2740         for (size_t i = 0; i < ret.datalen; i++) {
2741                 ret.data[i] = Path_clone(&orig->data[i]);
2742         }
2743         return ret;
2744 }
2745 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2746         LDKRoute ret = *owner->contents.result;
2747         ret.is_owned = false;
2748         return ret;
2749 }
2750 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2751         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2752         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2753         uint64_t ret_ref = 0;
2754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2756         return ret_ref;
2757 }
2758
2759 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2760 CHECK(!owner->result_ok);
2761         return DecodeError_clone(&*owner->contents.err);
2762 }
2763 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2764         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2765         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2766         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2767         uint64_t ret_ref = tag_ptr(ret_copy, true);
2768         return ret_ref;
2769 }
2770
2771 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2772         LDKRouteParameters ret = *owner->contents.result;
2773         ret.is_owned = false;
2774         return ret;
2775 }
2776 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2777         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2778         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2779         uint64_t ret_ref = 0;
2780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2782         return ret_ref;
2783 }
2784
2785 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2786 CHECK(!owner->result_ok);
2787         return DecodeError_clone(&*owner->contents.err);
2788 }
2789 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2790         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2792         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2793         uint64_t ret_ref = tag_ptr(ret_copy, true);
2794         return ret_ref;
2795 }
2796
2797 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2798         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2799         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2800         return ret;
2801 }
2802 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2803         LDKPaymentParameters ret = *owner->contents.result;
2804         ret.is_owned = false;
2805         return ret;
2806 }
2807 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2808         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2809         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2810         uint64_t ret_ref = 0;
2811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2813         return ret_ref;
2814 }
2815
2816 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2817 CHECK(!owner->result_ok);
2818         return DecodeError_clone(&*owner->contents.err);
2819 }
2820 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2821         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2822         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2823         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2824         uint64_t ret_ref = tag_ptr(ret_copy, true);
2825         return ret_ref;
2826 }
2827
2828 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2829         LDKBlindedPayInfo ret = owner->a;
2830         ret.is_owned = false;
2831         return ret;
2832 }
2833 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2834         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2835         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2836         uint64_t ret_ref = 0;
2837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2839         return ret_ref;
2840 }
2841
2842 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2843         LDKBlindedPath ret = owner->b;
2844         ret.is_owned = false;
2845         return ret;
2846 }
2847 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2848         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2849         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2850         uint64_t ret_ref = 0;
2851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2853         return ret_ref;
2854 }
2855
2856 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2857         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2858         for (size_t i = 0; i < ret.datalen; i++) {
2859                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2860         }
2861         return ret;
2862 }
2863 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2864         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2865         for (size_t i = 0; i < ret.datalen; i++) {
2866                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2867         }
2868         return ret;
2869 }
2870 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2871         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2872         for (size_t i = 0; i < ret.datalen; i++) {
2873                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2874         }
2875         return ret;
2876 }
2877 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2878         LDKRouteHint ret = *owner->contents.result;
2879         ret.is_owned = false;
2880         return ret;
2881 }
2882 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2883         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2884         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2885         uint64_t ret_ref = 0;
2886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2888         return ret_ref;
2889 }
2890
2891 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2892 CHECK(!owner->result_ok);
2893         return DecodeError_clone(&*owner->contents.err);
2894 }
2895 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2896         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2897         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2898         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2899         uint64_t ret_ref = tag_ptr(ret_copy, true);
2900         return ret_ref;
2901 }
2902
2903 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2904         LDKRouteHintHop ret = *owner->contents.result;
2905         ret.is_owned = false;
2906         return ret;
2907 }
2908 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2909         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2910         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2911         uint64_t ret_ref = 0;
2912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2914         return ret_ref;
2915 }
2916
2917 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2918 CHECK(!owner->result_ok);
2919         return DecodeError_clone(&*owner->contents.err);
2920 }
2921 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2922         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2923         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2924         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2925         uint64_t ret_ref = tag_ptr(ret_copy, true);
2926         return ret_ref;
2927 }
2928
2929 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2930         return owner->a;
2931 }
2932 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2933         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2934         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2935         return ret_conv;
2936 }
2937
2938 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2939         return owner->b;
2940 }
2941 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2942         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2943         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2944         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2945         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2946         return ret_arr;
2947 }
2948
2949 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2950         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2951         for (size_t i = 0; i < ret.datalen; i++) {
2952                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2953         }
2954         return ret;
2955 }
2956 uint32_t __attribute__((export_name("TS_LDKCOption_BlockHashZ_ty_from_ptr"))) TS_LDKCOption_BlockHashZ_ty_from_ptr(uint64_t ptr) {
2957         LDKCOption_BlockHashZ *obj = (LDKCOption_BlockHashZ*)untag_ptr(ptr);
2958         switch(obj->tag) {
2959                 case LDKCOption_BlockHashZ_Some: return 0;
2960                 case LDKCOption_BlockHashZ_None: return 1;
2961                 default: abort();
2962         }
2963 }
2964 int8_tArray __attribute__((export_name("TS_LDKCOption_BlockHashZ_Some_get_some"))) TS_LDKCOption_BlockHashZ_Some_get_some(uint64_t ptr) {
2965         LDKCOption_BlockHashZ *obj = (LDKCOption_BlockHashZ*)untag_ptr(ptr);
2966         assert(obj->tag == LDKCOption_BlockHashZ_Some);
2967                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
2968                         memcpy(some_arr->elems, obj->some.data, 32);
2969         return some_arr;
2970 }
2971 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCOption_BlockHashZZ_get_a(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR owner){
2972         return ThirtyTwoBytes_clone(&owner->a);
2973 }
2974 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_get_a"))) TS_C2Tuple_TxidCOption_BlockHashZZ_get_a(uint64_t owner) {
2975         LDKC2Tuple_TxidCOption_BlockHashZZ* owner_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(owner);
2976         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2977         memcpy(ret_arr->elems, C2Tuple_TxidCOption_BlockHashZZ_get_a(owner_conv).data, 32);
2978         return ret_arr;
2979 }
2980
2981 static inline struct LDKCOption_BlockHashZ C2Tuple_TxidCOption_BlockHashZZ_get_b(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR owner){
2982         return COption_BlockHashZ_clone(&owner->b);
2983 }
2984 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_get_b"))) TS_C2Tuple_TxidCOption_BlockHashZZ_get_b(uint64_t owner) {
2985         LDKC2Tuple_TxidCOption_BlockHashZZ* owner_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(owner);
2986         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
2987         *ret_copy = C2Tuple_TxidCOption_BlockHashZZ_get_b(owner_conv);
2988         uint64_t ret_ref = tag_ptr(ret_copy, true);
2989         return ret_ref;
2990 }
2991
2992 static inline LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ CVec_C2Tuple_TxidCOption_BlockHashZZZ_clone(const LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ *orig) {
2993         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ clone bytes"), .datalen = orig->datalen };
2994         for (size_t i = 0; i < ret.datalen; i++) {
2995                 ret.data[i] = C2Tuple_TxidCOption_BlockHashZZ_clone(&orig->data[i]);
2996         }
2997         return ret;
2998 }
2999 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
3000         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3001         switch(obj->tag) {
3002                 case LDKMonitorEvent_HTLCEvent: return 0;
3003                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
3004                 case LDKMonitorEvent_Completed: return 2;
3005                 case LDKMonitorEvent_UpdateFailed: return 3;
3006                 default: abort();
3007         }
3008 }
3009 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
3010         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3011         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
3012                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3013                         uint64_t htlc_event_ref = 0;
3014                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3015                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3016         return htlc_event_ref;
3017 }
3018 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
3019         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3020         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
3021                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3022                         uint64_t commitment_tx_confirmed_ref = 0;
3023                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3024                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
3025         return commitment_tx_confirmed_ref;
3026 }
3027 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
3028         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3029         assert(obj->tag == LDKMonitorEvent_Completed);
3030                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3031                         uint64_t funding_txo_ref = 0;
3032                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3033                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3034         return funding_txo_ref;
3035 }
3036 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
3037         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3038         assert(obj->tag == LDKMonitorEvent_Completed);
3039                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3040         return monitor_update_id_conv;
3041 }
3042 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
3043         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3044         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
3045                         LDKOutPoint update_failed_var = obj->update_failed;
3046                         uint64_t update_failed_ref = 0;
3047                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3048                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
3049         return update_failed_ref;
3050 }
3051 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3052         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3053         for (size_t i = 0; i < ret.datalen; i++) {
3054                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3055         }
3056         return ret;
3057 }
3058 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3059         LDKOutPoint ret = owner->a;
3060         ret.is_owned = false;
3061         return ret;
3062 }
3063 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
3064         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3065         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3066         uint64_t ret_ref = 0;
3067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3069         return ret_ref;
3070 }
3071
3072 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3073         return CVec_MonitorEventZ_clone(&owner->b);
3074 }
3075 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
3076         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3077         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3078         uint64_tArray ret_arr = NULL;
3079         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
3080         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
3081         for (size_t o = 0; o < ret_var.datalen; o++) {
3082                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3083                 *ret_conv_14_copy = ret_var.data[o];
3084                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3085                 ret_arr_ptr[o] = ret_conv_14_ref;
3086         }
3087         
3088         FREE(ret_var.data);
3089         return ret_arr;
3090 }
3091
3092 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3093         return owner->c;
3094 }
3095 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
3096         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3097         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3098         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
3099         return ret_arr;
3100 }
3101
3102 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3103         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3104         for (size_t i = 0; i < ret.datalen; i++) {
3105                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3106         }
3107         return ret;
3108 }
3109 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3110         LDKFixedPenaltyScorer ret = *owner->contents.result;
3111         ret.is_owned = false;
3112         return ret;
3113 }
3114 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
3115         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3116         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3117         uint64_t ret_ref = 0;
3118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3120         return ret_ref;
3121 }
3122
3123 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3124 CHECK(!owner->result_ok);
3125         return DecodeError_clone(&*owner->contents.err);
3126 }
3127 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
3128         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3129         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3130         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3131         uint64_t ret_ref = tag_ptr(ret_copy, true);
3132         return ret_ref;
3133 }
3134
3135 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3136         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3137         for (size_t i = 0; i < ret.datalen; i++) {
3138                 ret.data[i] = NodeId_clone(&orig->data[i]);
3139         }
3140         return ret;
3141 }
3142 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3143         return owner->a;
3144 }
3145 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
3146         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3147         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3148         return ret_conv;
3149 }
3150
3151 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3152         return owner->b;
3153 }
3154 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
3155         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3156         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3157         return ret_conv;
3158 }
3159
3160 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
3161         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3162         switch(obj->tag) {
3163                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
3164                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
3165                 default: abort();
3166         }
3167 }
3168 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
3169         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3170         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
3171                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3172                         *some_conv = obj->some;
3173                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3174         return tag_ptr(some_conv, true);
3175 }
3176 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
3177         return owner->a;
3178 }
3179 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
3180         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3181         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3182         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 8 * 2);
3183         return ret_arr;
3184 }
3185
3186 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
3187         return owner->b;
3188 }
3189 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
3190         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3191         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3192         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 8 * 2);
3193         return ret_arr;
3194 }
3195
3196 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
3197         return owner->a;
3198 }
3199 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_a"))) TS_C2Tuple__u168_u168Z_get_a(uint64_t owner) {
3200         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
3201         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3202         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_a(owner_conv).data, 8 * 2);
3203         return ret_arr;
3204 }
3205
3206 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
3207         return owner->b;
3208 }
3209 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_b"))) TS_C2Tuple__u168_u168Z_get_b(uint64_t owner) {
3210         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
3211         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3212         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_b(owner_conv).data, 8 * 2);
3213         return ret_arr;
3214 }
3215
3216 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr(uint64_t ptr) {
3217         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
3218         switch(obj->tag) {
3219                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: return 0;
3220                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: return 1;
3221                 default: abort();
3222         }
3223 }
3224 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some(uint64_t ptr) {
3225         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
3226         assert(obj->tag == LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some);
3227                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
3228                         *some_conv = obj->some;
3229                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
3230         return tag_ptr(some_conv, true);
3231 }
3232 typedef struct LDKLogger_JCalls {
3233         atomic_size_t refcnt;
3234         uint32_t instance_ptr;
3235 } LDKLogger_JCalls;
3236 static void LDKLogger_JCalls_free(void* this_arg) {
3237         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3238         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3239                 FREE(j_calls);
3240         }
3241 }
3242 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3243         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3244         LDKRecord record_var = *record;
3245         uint64_t record_ref = 0;
3246         record_var = Record_clone(&record_var);
3247         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3248         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3249         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
3250 }
3251 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3252         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3253         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3254 }
3255 static inline LDKLogger LDKLogger_init (JSValue o) {
3256         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3257         atomic_init(&calls->refcnt, 1);
3258         calls->instance_ptr = o;
3259
3260         LDKLogger ret = {
3261                 .this_arg = (void*) calls,
3262                 .log = log_LDKLogger_jcall,
3263                 .free = LDKLogger_JCalls_free,
3264         };
3265         return ret;
3266 }
3267 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
3268         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3269         *res_ptr = LDKLogger_init(o);
3270         return tag_ptr(res_ptr, true);
3271 }
3272 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3273         LDKProbabilisticScorer ret = *owner->contents.result;
3274         ret.is_owned = false;
3275         return ret;
3276 }
3277 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
3278         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3279         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3280         uint64_t ret_ref = 0;
3281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3283         return ret_ref;
3284 }
3285
3286 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3287 CHECK(!owner->result_ok);
3288         return DecodeError_clone(&*owner->contents.err);
3289 }
3290 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
3291         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3292         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3293         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3294         uint64_t ret_ref = tag_ptr(ret_copy, true);
3295         return ret_ref;
3296 }
3297
3298 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3299         LDKInitFeatures ret = *owner->contents.result;
3300         ret.is_owned = false;
3301         return ret;
3302 }
3303 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3304         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3305         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3306         uint64_t ret_ref = 0;
3307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3309         return ret_ref;
3310 }
3311
3312 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3313 CHECK(!owner->result_ok);
3314         return DecodeError_clone(&*owner->contents.err);
3315 }
3316 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3317         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3318         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3319         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3320         uint64_t ret_ref = tag_ptr(ret_copy, true);
3321         return ret_ref;
3322 }
3323
3324 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3325         LDKChannelFeatures ret = *owner->contents.result;
3326         ret.is_owned = false;
3327         return ret;
3328 }
3329 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3330         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3331         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3332         uint64_t ret_ref = 0;
3333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3335         return ret_ref;
3336 }
3337
3338 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3339 CHECK(!owner->result_ok);
3340         return DecodeError_clone(&*owner->contents.err);
3341 }
3342 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3343         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3344         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3345         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3346         uint64_t ret_ref = tag_ptr(ret_copy, true);
3347         return ret_ref;
3348 }
3349
3350 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3351         LDKNodeFeatures ret = *owner->contents.result;
3352         ret.is_owned = false;
3353         return ret;
3354 }
3355 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3356         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3357         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3358         uint64_t ret_ref = 0;
3359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3361         return ret_ref;
3362 }
3363
3364 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3365 CHECK(!owner->result_ok);
3366         return DecodeError_clone(&*owner->contents.err);
3367 }
3368 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3369         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3370         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3371         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3372         uint64_t ret_ref = tag_ptr(ret_copy, true);
3373         return ret_ref;
3374 }
3375
3376 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3377         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3378         ret.is_owned = false;
3379         return ret;
3380 }
3381 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3382         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3383         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3384         uint64_t ret_ref = 0;
3385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3387         return ret_ref;
3388 }
3389
3390 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3391 CHECK(!owner->result_ok);
3392         return DecodeError_clone(&*owner->contents.err);
3393 }
3394 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3395         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3396         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3397         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3398         uint64_t ret_ref = tag_ptr(ret_copy, true);
3399         return ret_ref;
3400 }
3401
3402 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3403         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3404         ret.is_owned = false;
3405         return ret;
3406 }
3407 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3408         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3409         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3410         uint64_t ret_ref = 0;
3411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3413         return ret_ref;
3414 }
3415
3416 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3417 CHECK(!owner->result_ok);
3418         return DecodeError_clone(&*owner->contents.err);
3419 }
3420 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3421         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3422         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3423         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3424         uint64_t ret_ref = tag_ptr(ret_copy, true);
3425         return ret_ref;
3426 }
3427
3428 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3429         LDKBlindedHopFeatures ret = *owner->contents.result;
3430         ret.is_owned = false;
3431         return ret;
3432 }
3433 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3434         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3435         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3436         uint64_t ret_ref = 0;
3437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3439         return ret_ref;
3440 }
3441
3442 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3443 CHECK(!owner->result_ok);
3444         return DecodeError_clone(&*owner->contents.err);
3445 }
3446 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3447         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3448         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3449         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3450         uint64_t ret_ref = tag_ptr(ret_copy, true);
3451         return ret_ref;
3452 }
3453
3454 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3455         LDKChannelTypeFeatures ret = *owner->contents.result;
3456         ret.is_owned = false;
3457         return ret;
3458 }
3459 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3460         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3461         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3462         uint64_t ret_ref = 0;
3463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3465         return ret_ref;
3466 }
3467
3468 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3469 CHECK(!owner->result_ok);
3470         return DecodeError_clone(&*owner->contents.err);
3471 }
3472 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3473         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3474         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3475         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3476         uint64_t ret_ref = tag_ptr(ret_copy, true);
3477         return ret_ref;
3478 }
3479
3480 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
3481         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
3482         switch(obj->tag) {
3483                 case LDKPaymentPurpose_InvoicePayment: return 0;
3484                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
3485                 default: abort();
3486         }
3487 }
3488 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
3489         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
3490         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
3491                         uint64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
3492         return payment_preimage_ref;
3493 }
3494 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
3495         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
3496         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
3497                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
3498                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
3499         return payment_secret_arr;
3500 }
3501 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
3502         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
3503         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
3504                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
3505                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
3506         return spontaneous_payment_arr;
3507 }
3508 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
3509 CHECK(owner->result_ok);
3510         return PaymentPurpose_clone(&*owner->contents.result);
3511 }
3512 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
3513         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
3514         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
3515         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
3516         uint64_t ret_ref = tag_ptr(ret_copy, true);
3517         return ret_ref;
3518 }
3519
3520 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
3521 CHECK(!owner->result_ok);
3522         return DecodeError_clone(&*owner->contents.err);
3523 }
3524 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
3525         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
3526         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3527         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
3528         uint64_t ret_ref = tag_ptr(ret_copy, true);
3529         return ret_ref;
3530 }
3531
3532 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3533         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3534         switch(obj->tag) {
3535                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3536                 case LDKNetworkUpdate_ChannelFailure: return 1;
3537                 case LDKNetworkUpdate_NodeFailure: return 2;
3538                 default: abort();
3539         }
3540 }
3541 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3542         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3543         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3544                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3545                         uint64_t msg_ref = 0;
3546                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3547                         msg_ref = tag_ptr(msg_var.inner, false);
3548         return msg_ref;
3549 }
3550 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3551         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3552         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3553                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3554         return short_channel_id_conv;
3555 }
3556 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3557         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3558         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3559                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3560         return is_permanent_conv;
3561 }
3562 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3563         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3564         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3565                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3566                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3567         return node_id_arr;
3568 }
3569 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3570         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3571         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3572                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3573         return is_permanent_conv;
3574 }
3575 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3576         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3577         switch(obj->tag) {
3578                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3579                 case LDKCOption_NetworkUpdateZ_None: return 1;
3580                 default: abort();
3581         }
3582 }
3583 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3584         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3585         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3586                         uint64_t some_ref = tag_ptr(&obj->some, false);
3587         return some_ref;
3588 }
3589 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
3590         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
3591         switch(obj->tag) {
3592                 case LDKPathFailure_InitialSend: return 0;
3593                 case LDKPathFailure_OnPath: return 1;
3594                 default: abort();
3595         }
3596 }
3597 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
3598         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
3599         assert(obj->tag == LDKPathFailure_InitialSend);
3600                         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
3601         return err_ref;
3602 }
3603 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
3604         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
3605         assert(obj->tag == LDKPathFailure_OnPath);
3606                         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
3607         return network_update_ref;
3608 }
3609 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
3610         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
3611         switch(obj->tag) {
3612                 case LDKCOption_PathFailureZ_Some: return 0;
3613                 case LDKCOption_PathFailureZ_None: return 1;
3614                 default: abort();
3615         }
3616 }
3617 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
3618         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
3619         assert(obj->tag == LDKCOption_PathFailureZ_Some);
3620                         uint64_t some_ref = tag_ptr(&obj->some, false);
3621         return some_ref;
3622 }
3623 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
3624 CHECK(owner->result_ok);
3625         return COption_PathFailureZ_clone(&*owner->contents.result);
3626 }
3627 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
3628         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
3629         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
3630         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
3631         uint64_t ret_ref = tag_ptr(ret_copy, true);
3632         return ret_ref;
3633 }
3634
3635 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
3636 CHECK(!owner->result_ok);
3637         return DecodeError_clone(&*owner->contents.err);
3638 }
3639 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
3640         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
3641         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3642         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
3643         uint64_t ret_ref = tag_ptr(ret_copy, true);
3644         return ret_ref;
3645 }
3646
3647 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
3648         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3649         switch(obj->tag) {
3650                 case LDKClosureReason_CounterpartyForceClosed: return 0;
3651                 case LDKClosureReason_HolderForceClosed: return 1;
3652                 case LDKClosureReason_CooperativeClosure: return 2;
3653                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
3654                 case LDKClosureReason_FundingTimedOut: return 4;
3655                 case LDKClosureReason_ProcessingError: return 5;
3656                 case LDKClosureReason_DisconnectedPeer: return 6;
3657                 case LDKClosureReason_OutdatedChannelManager: return 7;
3658                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
3659                 default: abort();
3660         }
3661 }
3662 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
3663         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3664         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
3665                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
3666                         uint64_t peer_msg_ref = 0;
3667                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
3668                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
3669         return peer_msg_ref;
3670 }
3671 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
3672         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3673         assert(obj->tag == LDKClosureReason_ProcessingError);
3674                         LDKStr err_str = obj->processing_error.err;
3675                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3676         return err_conv;
3677 }
3678 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
3679         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
3680         switch(obj->tag) {
3681                 case LDKCOption_ClosureReasonZ_Some: return 0;
3682                 case LDKCOption_ClosureReasonZ_None: return 1;
3683                 default: abort();
3684         }
3685 }
3686 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
3687         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
3688         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
3689                         uint64_t some_ref = tag_ptr(&obj->some, false);
3690         return some_ref;
3691 }
3692 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3693 CHECK(owner->result_ok);
3694         return COption_ClosureReasonZ_clone(&*owner->contents.result);
3695 }
3696 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
3697         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
3698         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
3699         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
3700         uint64_t ret_ref = tag_ptr(ret_copy, true);
3701         return ret_ref;
3702 }
3703
3704 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3705 CHECK(!owner->result_ok);
3706         return DecodeError_clone(&*owner->contents.err);
3707 }
3708 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
3709         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
3710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3711         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
3712         uint64_t ret_ref = tag_ptr(ret_copy, true);
3713         return ret_ref;
3714 }
3715
3716 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
3717         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3718         switch(obj->tag) {
3719                 case LDKHTLCDestination_NextHopChannel: return 0;
3720                 case LDKHTLCDestination_UnknownNextHop: return 1;
3721                 case LDKHTLCDestination_InvalidForward: return 2;
3722                 case LDKHTLCDestination_FailedPayment: return 3;
3723                 default: abort();
3724         }
3725 }
3726 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
3727         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3728         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
3729                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3730                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
3731         return node_id_arr;
3732 }
3733 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
3734         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3735         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
3736                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
3737                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
3738         return channel_id_arr;
3739 }
3740 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
3741         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3742         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
3743                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
3744         return requested_forward_scid_conv;
3745 }
3746 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
3747         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3748         assert(obj->tag == LDKHTLCDestination_InvalidForward);
3749                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
3750         return requested_forward_scid_conv;
3751 }
3752 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
3753         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3754         assert(obj->tag == LDKHTLCDestination_FailedPayment);
3755                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
3756                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
3757         return payment_hash_arr;
3758 }
3759 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
3760         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
3761         switch(obj->tag) {
3762                 case LDKCOption_HTLCDestinationZ_Some: return 0;
3763                 case LDKCOption_HTLCDestinationZ_None: return 1;
3764                 default: abort();
3765         }
3766 }
3767 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
3768         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
3769         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
3770                         uint64_t some_ref = tag_ptr(&obj->some, false);
3771         return some_ref;
3772 }
3773 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
3774 CHECK(owner->result_ok);
3775         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
3776 }
3777 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
3778         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
3779         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
3780         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
3781         uint64_t ret_ref = tag_ptr(ret_copy, true);
3782         return ret_ref;
3783 }
3784
3785 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
3786 CHECK(!owner->result_ok);
3787         return DecodeError_clone(&*owner->contents.err);
3788 }
3789 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
3790         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
3791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3792         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
3793         uint64_t ret_ref = tag_ptr(ret_copy, true);
3794         return ret_ref;
3795 }
3796
3797 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
3798 CHECK(owner->result_ok);
3799         return PaymentFailureReason_clone(&*owner->contents.result);
3800 }
3801 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
3802         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
3803         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
3804         return ret_conv;
3805 }
3806
3807 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
3808 CHECK(!owner->result_ok);
3809         return DecodeError_clone(&*owner->contents.err);
3810 }
3811 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
3812         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
3813         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3814         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
3815         uint64_t ret_ref = tag_ptr(ret_copy, true);
3816         return ret_ref;
3817 }
3818
3819 uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) {
3820         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
3821         switch(obj->tag) {
3822                 case LDKCOption_u128Z_Some: return 0;
3823                 case LDKCOption_u128Z_None: return 1;
3824                 default: abort();
3825         }
3826 }
3827 int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) {
3828         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
3829         assert(obj->tag == LDKCOption_u128Z_Some);
3830                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
3831                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
3832         return some_arr;
3833 }
3834 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentIdZ_ty_from_ptr"))) TS_LDKCOption_PaymentIdZ_ty_from_ptr(uint64_t ptr) {
3835         LDKCOption_PaymentIdZ *obj = (LDKCOption_PaymentIdZ*)untag_ptr(ptr);
3836         switch(obj->tag) {
3837                 case LDKCOption_PaymentIdZ_Some: return 0;
3838                 case LDKCOption_PaymentIdZ_None: return 1;
3839                 default: abort();
3840         }
3841 }
3842 int8_tArray __attribute__((export_name("TS_LDKCOption_PaymentIdZ_Some_get_some"))) TS_LDKCOption_PaymentIdZ_Some_get_some(uint64_t ptr) {
3843         LDKCOption_PaymentIdZ *obj = (LDKCOption_PaymentIdZ*)untag_ptr(ptr);
3844         assert(obj->tag == LDKCOption_PaymentIdZ_Some);
3845                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
3846                         memcpy(some_arr->elems, obj->some.data, 32);
3847         return some_arr;
3848 }
3849 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
3850         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
3851         switch(obj->tag) {
3852                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
3853                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
3854                 default: abort();
3855         }
3856 }
3857 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
3858         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
3859         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
3860                         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
3861         return some_conv;
3862 }
3863 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentHashZ_ty_from_ptr"))) TS_LDKCOption_PaymentHashZ_ty_from_ptr(uint64_t ptr) {
3864         LDKCOption_PaymentHashZ *obj = (LDKCOption_PaymentHashZ*)untag_ptr(ptr);
3865         switch(obj->tag) {
3866                 case LDKCOption_PaymentHashZ_Some: return 0;
3867                 case LDKCOption_PaymentHashZ_None: return 1;
3868                 default: abort();
3869         }
3870 }
3871 int8_tArray __attribute__((export_name("TS_LDKCOption_PaymentHashZ_Some_get_some"))) TS_LDKCOption_PaymentHashZ_Some_get_some(uint64_t ptr) {
3872         LDKCOption_PaymentHashZ *obj = (LDKCOption_PaymentHashZ*)untag_ptr(ptr);
3873         assert(obj->tag == LDKCOption_PaymentHashZ_Some);
3874                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
3875                         memcpy(some_arr->elems, obj->some.data, 32);
3876         return some_arr;
3877 }
3878 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
3879         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
3880         for (size_t i = 0; i < ret.datalen; i++) {
3881                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
3882         }
3883         return ret;
3884 }
3885 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
3886         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
3887         for (size_t i = 0; i < ret.datalen; i++) {
3888                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
3889         }
3890         return ret;
3891 }
3892 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
3893         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3894         switch(obj->tag) {
3895                 case LDKBumpTransactionEvent_ChannelClose: return 0;
3896                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
3897                 default: abort();
3898         }
3899 }
3900 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
3901         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3902         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3903                         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
3904                         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
3905         return claim_id_arr;
3906 }
3907 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) {
3908         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3909         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3910                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
3911         return package_target_feerate_sat_per_1000_weight_conv;
3912 }
3913 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
3914         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3915         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3916                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
3917                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
3918                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
3919         return commitment_tx_arr;
3920 }
3921 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
3922         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3923         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3924                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
3925         return commitment_tx_fee_satoshis_conv;
3926 }
3927 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
3928         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3929         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3930                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
3931                         uint64_t anchor_descriptor_ref = 0;
3932                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
3933                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
3934         return anchor_descriptor_ref;
3935 }
3936 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
3937         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3938         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3939                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
3940                         uint64_tArray pending_htlcs_arr = NULL;
3941                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
3942                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
3943                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
3944                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
3945                                 uint64_t pending_htlcs_conv_24_ref = 0;
3946                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
3947                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
3948                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
3949                         }
3950                         
3951         return pending_htlcs_arr;
3952 }
3953 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
3954         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3955         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
3956                         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
3957                         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
3958         return claim_id_arr;
3959 }
3960 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) {
3961         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3962         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
3963                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
3964         return target_feerate_sat_per_1000_weight_conv;
3965 }
3966 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
3967         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3968         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
3969                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
3970                         uint64_tArray htlc_descriptors_arr = NULL;
3971                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
3972                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
3973                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
3974                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
3975                                 uint64_t htlc_descriptors_conv_16_ref = 0;
3976                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
3977                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
3978                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
3979                         }
3980                         
3981         return htlc_descriptors_arr;
3982 }
3983 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
3984         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3985         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
3986                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
3987         return tx_lock_time_conv;
3988 }
3989 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
3990         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
3991         switch(obj->tag) {
3992                 case LDKEvent_FundingGenerationReady: return 0;
3993                 case LDKEvent_PaymentClaimable: return 1;
3994                 case LDKEvent_PaymentClaimed: return 2;
3995                 case LDKEvent_PaymentSent: return 3;
3996                 case LDKEvent_PaymentFailed: return 4;
3997                 case LDKEvent_PaymentPathSuccessful: return 5;
3998                 case LDKEvent_PaymentPathFailed: return 6;
3999                 case LDKEvent_ProbeSuccessful: return 7;
4000                 case LDKEvent_ProbeFailed: return 8;
4001                 case LDKEvent_PendingHTLCsForwardable: return 9;
4002                 case LDKEvent_HTLCIntercepted: return 10;
4003                 case LDKEvent_SpendableOutputs: return 11;
4004                 case LDKEvent_PaymentForwarded: return 12;
4005                 case LDKEvent_ChannelPending: return 13;
4006                 case LDKEvent_ChannelReady: return 14;
4007                 case LDKEvent_ChannelClosed: return 15;
4008                 case LDKEvent_DiscardFunding: return 16;
4009                 case LDKEvent_OpenChannelRequest: return 17;
4010                 case LDKEvent_HTLCHandlingFailed: return 18;
4011                 case LDKEvent_BumpTransaction: return 19;
4012                 default: abort();
4013         }
4014 }
4015 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
4016         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4017         assert(obj->tag == LDKEvent_FundingGenerationReady);
4018                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
4019                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
4020         return temporary_channel_id_arr;
4021 }
4022 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
4023         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4024         assert(obj->tag == LDKEvent_FundingGenerationReady);
4025                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
4026                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
4027         return counterparty_node_id_arr;
4028 }
4029 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
4030         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4031         assert(obj->tag == LDKEvent_FundingGenerationReady);
4032                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
4033         return channel_value_satoshis_conv;
4034 }
4035 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
4036         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4037         assert(obj->tag == LDKEvent_FundingGenerationReady);
4038                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4039                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
4040                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
4041         return output_script_arr;
4042 }
4043 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
4044         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4045         assert(obj->tag == LDKEvent_FundingGenerationReady);
4046                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
4047                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
4048         return user_channel_id_arr;
4049 }
4050 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
4051         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4052         assert(obj->tag == LDKEvent_PaymentClaimable);
4053                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
4054                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
4055         return receiver_node_id_arr;
4056 }
4057 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
4058         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4059         assert(obj->tag == LDKEvent_PaymentClaimable);
4060                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4061                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
4062         return payment_hash_arr;
4063 }
4064 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
4065         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4066         assert(obj->tag == LDKEvent_PaymentClaimable);
4067                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
4068                         uint64_t onion_fields_ref = 0;
4069                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
4070                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
4071         return onion_fields_ref;
4072 }
4073 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
4074         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4075         assert(obj->tag == LDKEvent_PaymentClaimable);
4076                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
4077         return amount_msat_conv;
4078 }
4079 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
4080         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4081         assert(obj->tag == LDKEvent_PaymentClaimable);
4082                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
4083         return counterparty_skimmed_fee_msat_conv;
4084 }
4085 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
4086         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4087         assert(obj->tag == LDKEvent_PaymentClaimable);
4088                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
4089         return purpose_ref;
4090 }
4091 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
4092         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4093         assert(obj->tag == LDKEvent_PaymentClaimable);
4094                         int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__);
4095                         memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32);
4096         return via_channel_id_arr;
4097 }
4098 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
4099         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4100         assert(obj->tag == LDKEvent_PaymentClaimable);
4101                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
4102         return via_user_channel_id_ref;
4103 }
4104 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
4105         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4106         assert(obj->tag == LDKEvent_PaymentClaimable);
4107                         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
4108         return claim_deadline_ref;
4109 }
4110 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
4111         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4112         assert(obj->tag == LDKEvent_PaymentClaimed);
4113                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
4114                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
4115         return receiver_node_id_arr;
4116 }
4117 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
4118         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4119         assert(obj->tag == LDKEvent_PaymentClaimed);
4120                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4121                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
4122         return payment_hash_arr;
4123 }
4124 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
4125         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4126         assert(obj->tag == LDKEvent_PaymentClaimed);
4127                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
4128         return amount_msat_conv;
4129 }
4130 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
4131         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4132         assert(obj->tag == LDKEvent_PaymentClaimed);
4133                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
4134         return purpose_ref;
4135 }
4136 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
4137         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4138         assert(obj->tag == LDKEvent_PaymentSent);
4139                         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
4140         return payment_id_ref;
4141 }
4142 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
4143         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4144         assert(obj->tag == LDKEvent_PaymentSent);
4145                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
4146                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
4147         return payment_preimage_arr;
4148 }
4149 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
4150         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4151         assert(obj->tag == LDKEvent_PaymentSent);
4152                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4153                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
4154         return payment_hash_arr;
4155 }
4156 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
4157         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4158         assert(obj->tag == LDKEvent_PaymentSent);
4159                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
4160         return fee_paid_msat_ref;
4161 }
4162 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
4163         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4164         assert(obj->tag == LDKEvent_PaymentFailed);
4165                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4166                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
4167         return payment_id_arr;
4168 }
4169 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
4170         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4171         assert(obj->tag == LDKEvent_PaymentFailed);
4172                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4173                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
4174         return payment_hash_arr;
4175 }
4176 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
4177         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4178         assert(obj->tag == LDKEvent_PaymentFailed);
4179                         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
4180         return reason_ref;
4181 }
4182 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
4183         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4184         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
4185                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4186                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
4187         return payment_id_arr;
4188 }
4189 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
4190         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4191         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
4192                         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
4193         return payment_hash_ref;
4194 }
4195 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
4196         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4197         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
4198                         LDKPath path_var = obj->payment_path_successful.path;
4199                         uint64_t path_ref = 0;
4200                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4201                         path_ref = tag_ptr(path_var.inner, false);
4202         return path_ref;
4203 }
4204 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
4205         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4206         assert(obj->tag == LDKEvent_PaymentPathFailed);
4207                         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
4208         return payment_id_ref;
4209 }
4210 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
4211         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4212         assert(obj->tag == LDKEvent_PaymentPathFailed);
4213                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4214                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
4215         return payment_hash_arr;
4216 }
4217 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
4218         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4219         assert(obj->tag == LDKEvent_PaymentPathFailed);
4220                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
4221         return payment_failed_permanently_conv;
4222 }
4223 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
4224         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4225         assert(obj->tag == LDKEvent_PaymentPathFailed);
4226                         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
4227         return failure_ref;
4228 }
4229 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
4230         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4231         assert(obj->tag == LDKEvent_PaymentPathFailed);
4232                         LDKPath path_var = obj->payment_path_failed.path;
4233                         uint64_t path_ref = 0;
4234                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4235                         path_ref = tag_ptr(path_var.inner, false);
4236         return path_ref;
4237 }
4238 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
4239         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4240         assert(obj->tag == LDKEvent_PaymentPathFailed);
4241                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
4242         return short_channel_id_ref;
4243 }
4244 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
4245         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4246         assert(obj->tag == LDKEvent_ProbeSuccessful);
4247                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4248                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
4249         return payment_id_arr;
4250 }
4251 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
4252         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4253         assert(obj->tag == LDKEvent_ProbeSuccessful);
4254                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4255                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
4256         return payment_hash_arr;
4257 }
4258 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
4259         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4260         assert(obj->tag == LDKEvent_ProbeSuccessful);
4261                         LDKPath path_var = obj->probe_successful.path;
4262                         uint64_t path_ref = 0;
4263                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4264                         path_ref = tag_ptr(path_var.inner, false);
4265         return path_ref;
4266 }
4267 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
4268         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4269         assert(obj->tag == LDKEvent_ProbeFailed);
4270                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4271                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
4272         return payment_id_arr;
4273 }
4274 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
4275         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4276         assert(obj->tag == LDKEvent_ProbeFailed);
4277                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4278                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
4279         return payment_hash_arr;
4280 }
4281 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
4282         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4283         assert(obj->tag == LDKEvent_ProbeFailed);
4284                         LDKPath path_var = obj->probe_failed.path;
4285                         uint64_t path_ref = 0;
4286                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4287                         path_ref = tag_ptr(path_var.inner, false);
4288         return path_ref;
4289 }
4290 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
4291         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4292         assert(obj->tag == LDKEvent_ProbeFailed);
4293                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
4294         return short_channel_id_ref;
4295 }
4296 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
4297         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4298         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
4299                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
4300         return time_forwardable_conv;
4301 }
4302 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
4303         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4304         assert(obj->tag == LDKEvent_HTLCIntercepted);
4305                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
4306                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
4307         return intercept_id_arr;
4308 }
4309 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
4310         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4311         assert(obj->tag == LDKEvent_HTLCIntercepted);
4312                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
4313         return requested_next_hop_scid_conv;
4314 }
4315 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
4316         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4317         assert(obj->tag == LDKEvent_HTLCIntercepted);
4318                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4319                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
4320         return payment_hash_arr;
4321 }
4322 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
4323         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4324         assert(obj->tag == LDKEvent_HTLCIntercepted);
4325                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
4326         return inbound_amount_msat_conv;
4327 }
4328 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
4329         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4330         assert(obj->tag == LDKEvent_HTLCIntercepted);
4331                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
4332         return expected_outbound_amount_msat_conv;
4333 }
4334 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
4335         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4336         assert(obj->tag == LDKEvent_SpendableOutputs);
4337                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4338                         uint64_tArray outputs_arr = NULL;
4339                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
4340                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
4341                         for (size_t b = 0; b < outputs_var.datalen; b++) {
4342                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
4343                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
4344                         }
4345                         
4346         return outputs_arr;
4347 }
4348 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
4349         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4350         assert(obj->tag == LDKEvent_PaymentForwarded);
4351                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
4352                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
4353         return prev_channel_id_arr;
4354 }
4355 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
4356         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4357         assert(obj->tag == LDKEvent_PaymentForwarded);
4358                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
4359                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
4360         return next_channel_id_arr;
4361 }
4362 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
4363         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4364         assert(obj->tag == LDKEvent_PaymentForwarded);
4365                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
4366         return fee_earned_msat_ref;
4367 }
4368 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
4369         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4370         assert(obj->tag == LDKEvent_PaymentForwarded);
4371                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
4372         return claim_from_onchain_tx_conv;
4373 }
4374 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
4375         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4376         assert(obj->tag == LDKEvent_PaymentForwarded);
4377                         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
4378         return outbound_amount_forwarded_msat_ref;
4379 }
4380 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
4381         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4382         assert(obj->tag == LDKEvent_ChannelPending);
4383                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
4384                         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
4385         return channel_id_arr;
4386 }
4387 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
4388         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4389         assert(obj->tag == LDKEvent_ChannelPending);
4390                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
4391                         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
4392         return user_channel_id_arr;
4393 }
4394 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
4395         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4396         assert(obj->tag == LDKEvent_ChannelPending);
4397                         int8_tArray former_temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
4398                         memcpy(former_temporary_channel_id_arr->elems, obj->channel_pending.former_temporary_channel_id.data, 32);
4399         return former_temporary_channel_id_arr;
4400 }
4401 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
4402         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4403         assert(obj->tag == LDKEvent_ChannelPending);
4404                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
4405                         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
4406         return counterparty_node_id_arr;
4407 }
4408 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
4409         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4410         assert(obj->tag == LDKEvent_ChannelPending);
4411                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
4412                         uint64_t funding_txo_ref = 0;
4413                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4414                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
4415         return funding_txo_ref;
4416 }
4417 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
4418         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4419         assert(obj->tag == LDKEvent_ChannelReady);
4420                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
4421                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
4422         return channel_id_arr;
4423 }
4424 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
4425         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4426         assert(obj->tag == LDKEvent_ChannelReady);
4427                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
4428                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
4429         return user_channel_id_arr;
4430 }
4431 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
4432         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4433         assert(obj->tag == LDKEvent_ChannelReady);
4434                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
4435                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
4436         return counterparty_node_id_arr;
4437 }
4438 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
4439         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4440         assert(obj->tag == LDKEvent_ChannelReady);
4441                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
4442                         uint64_t channel_type_ref = 0;
4443                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
4444                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
4445         return channel_type_ref;
4446 }
4447 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
4448         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4449         assert(obj->tag == LDKEvent_ChannelClosed);
4450                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
4451                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
4452         return channel_id_arr;
4453 }
4454 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
4455         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4456         assert(obj->tag == LDKEvent_ChannelClosed);
4457                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
4458                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
4459         return user_channel_id_arr;
4460 }
4461 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
4462         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4463         assert(obj->tag == LDKEvent_ChannelClosed);
4464                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
4465         return reason_ref;
4466 }
4467 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
4468         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4469         assert(obj->tag == LDKEvent_DiscardFunding);
4470                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
4471                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
4472         return channel_id_arr;
4473 }
4474 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
4475         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4476         assert(obj->tag == LDKEvent_DiscardFunding);
4477                         LDKTransaction transaction_var = obj->discard_funding.transaction;
4478                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
4479                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
4480         return transaction_arr;
4481 }
4482 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
4483         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4484         assert(obj->tag == LDKEvent_OpenChannelRequest);
4485                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
4486                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
4487         return temporary_channel_id_arr;
4488 }
4489 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
4490         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4491         assert(obj->tag == LDKEvent_OpenChannelRequest);
4492                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
4493                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
4494         return counterparty_node_id_arr;
4495 }
4496 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
4497         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4498         assert(obj->tag == LDKEvent_OpenChannelRequest);
4499                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
4500         return funding_satoshis_conv;
4501 }
4502 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
4503         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4504         assert(obj->tag == LDKEvent_OpenChannelRequest);
4505                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
4506         return push_msat_conv;
4507 }
4508 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
4509         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4510         assert(obj->tag == LDKEvent_OpenChannelRequest);
4511                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
4512                         uint64_t channel_type_ref = 0;
4513                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
4514                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
4515         return channel_type_ref;
4516 }
4517 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
4518         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4519         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
4520                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
4521                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
4522         return prev_channel_id_arr;
4523 }
4524 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
4525         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4526         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
4527                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
4528         return failed_next_destination_ref;
4529 }
4530 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
4531         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4532         assert(obj->tag == LDKEvent_BumpTransaction);
4533                         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
4534         return bump_transaction_ref;
4535 }
4536 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
4537         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
4538         switch(obj->tag) {
4539                 case LDKCOption_EventZ_Some: return 0;
4540                 case LDKCOption_EventZ_None: return 1;
4541                 default: abort();
4542         }
4543 }
4544 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
4545         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
4546         assert(obj->tag == LDKCOption_EventZ_Some);
4547                         uint64_t some_ref = tag_ptr(&obj->some, false);
4548         return some_ref;
4549 }
4550 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
4551 CHECK(owner->result_ok);
4552         return COption_EventZ_clone(&*owner->contents.result);
4553 }
4554 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
4555         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
4556         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
4557         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
4558         uint64_t ret_ref = tag_ptr(ret_copy, true);
4559         return ret_ref;
4560 }
4561
4562 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
4563 CHECK(!owner->result_ok);
4564         return DecodeError_clone(&*owner->contents.err);
4565 }
4566 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
4567         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
4568         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4569         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
4570         uint64_t ret_ref = tag_ptr(ret_copy, true);
4571         return ret_ref;
4572 }
4573
4574 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
4575         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4576         switch(obj->tag) {
4577                 case LDKErrorAction_DisconnectPeer: return 0;
4578                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4579                 case LDKErrorAction_IgnoreError: return 2;
4580                 case LDKErrorAction_IgnoreAndLog: return 3;
4581                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4582                 case LDKErrorAction_SendErrorMessage: return 5;
4583                 case LDKErrorAction_SendWarningMessage: return 6;
4584                 default: abort();
4585         }
4586 }
4587 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
4588         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4589         assert(obj->tag == LDKErrorAction_DisconnectPeer);
4590                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4591                         uint64_t msg_ref = 0;
4592                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4593                         msg_ref = tag_ptr(msg_var.inner, false);
4594         return msg_ref;
4595 }
4596 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
4597         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4598         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4599                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4600                         uint64_t msg_ref = 0;
4601                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4602                         msg_ref = tag_ptr(msg_var.inner, false);
4603         return msg_ref;
4604 }
4605 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
4606         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4607         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
4608                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
4609         return ignore_and_log_conv;
4610 }
4611 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
4612         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4613         assert(obj->tag == LDKErrorAction_SendErrorMessage);
4614                         LDKErrorMessage msg_var = obj->send_error_message.msg;
4615                         uint64_t msg_ref = 0;
4616                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4617                         msg_ref = tag_ptr(msg_var.inner, false);
4618         return msg_ref;
4619 }
4620 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
4621         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4622         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4623                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4624                         uint64_t msg_ref = 0;
4625                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4626                         msg_ref = tag_ptr(msg_var.inner, false);
4627         return msg_ref;
4628 }
4629 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
4630         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4631         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4632                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
4633         return log_level_conv;
4634 }
4635 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
4636         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4637         switch(obj->tag) {
4638                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4639                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4640                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4641                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4642                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4643                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4644                 case LDKMessageSendEvent_SendTxAddInput: return 6;
4645                 case LDKMessageSendEvent_SendTxAddOutput: return 7;
4646                 case LDKMessageSendEvent_SendTxRemoveInput: return 8;
4647                 case LDKMessageSendEvent_SendTxRemoveOutput: return 9;
4648                 case LDKMessageSendEvent_SendTxComplete: return 10;
4649                 case LDKMessageSendEvent_SendTxSignatures: return 11;
4650                 case LDKMessageSendEvent_SendTxInitRbf: return 12;
4651                 case LDKMessageSendEvent_SendTxAckRbf: return 13;
4652                 case LDKMessageSendEvent_SendTxAbort: return 14;
4653                 case LDKMessageSendEvent_SendChannelReady: return 15;
4654                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 16;
4655                 case LDKMessageSendEvent_UpdateHTLCs: return 17;
4656                 case LDKMessageSendEvent_SendRevokeAndACK: return 18;
4657                 case LDKMessageSendEvent_SendClosingSigned: return 19;
4658                 case LDKMessageSendEvent_SendShutdown: return 20;
4659                 case LDKMessageSendEvent_SendChannelReestablish: return 21;
4660                 case LDKMessageSendEvent_SendChannelAnnouncement: return 22;
4661                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 23;
4662                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 24;
4663                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 25;
4664                 case LDKMessageSendEvent_SendChannelUpdate: return 26;
4665                 case LDKMessageSendEvent_HandleError: return 27;
4666                 case LDKMessageSendEvent_SendChannelRangeQuery: return 28;
4667                 case LDKMessageSendEvent_SendShortIdsQuery: return 29;
4668                 case LDKMessageSendEvent_SendReplyChannelRange: return 30;
4669                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 31;
4670                 default: abort();
4671         }
4672 }
4673 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
4674         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4675         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4676                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4677                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4678         return node_id_arr;
4679 }
4680 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
4681         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4682         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4683                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4684                         uint64_t msg_ref = 0;
4685                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4686                         msg_ref = tag_ptr(msg_var.inner, false);
4687         return msg_ref;
4688 }
4689 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
4690         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4691         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4692                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4693                         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4694         return node_id_arr;
4695 }
4696 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
4697         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4698         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4699                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4700                         uint64_t msg_ref = 0;
4701                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4702                         msg_ref = tag_ptr(msg_var.inner, false);
4703         return msg_ref;
4704 }
4705 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
4706         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4707         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4708                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4709                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4710         return node_id_arr;
4711 }
4712 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
4713         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4714         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4715                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4716                         uint64_t msg_ref = 0;
4717                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4718                         msg_ref = tag_ptr(msg_var.inner, false);
4719         return msg_ref;
4720 }
4721 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
4722         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4723         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4724                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4725                         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4726         return node_id_arr;
4727 }
4728 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
4729         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4730         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4731                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4732                         uint64_t msg_ref = 0;
4733                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4734                         msg_ref = tag_ptr(msg_var.inner, false);
4735         return msg_ref;
4736 }
4737 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
4738         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4739         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4740                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4741                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4742         return node_id_arr;
4743 }
4744 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
4745         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4746         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4747                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4748                         uint64_t msg_ref = 0;
4749                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4750                         msg_ref = tag_ptr(msg_var.inner, false);
4751         return msg_ref;
4752 }
4753 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
4754         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4755         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4756                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4757                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4758         return node_id_arr;
4759 }
4760 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
4761         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4762         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4763                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4764                         uint64_t msg_ref = 0;
4765                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4766                         msg_ref = tag_ptr(msg_var.inner, false);
4767         return msg_ref;
4768 }
4769 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
4770         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4771         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4772                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4773                         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
4774         return node_id_arr;
4775 }
4776 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
4777         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4778         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4779                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
4780                         uint64_t msg_ref = 0;
4781                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4782                         msg_ref = tag_ptr(msg_var.inner, false);
4783         return msg_ref;
4784 }
4785 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
4786         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4787         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4788                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4789                         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
4790         return node_id_arr;
4791 }
4792 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
4793         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4794         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4795                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
4796                         uint64_t msg_ref = 0;
4797                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4798                         msg_ref = tag_ptr(msg_var.inner, false);
4799         return msg_ref;
4800 }
4801 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
4802         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4803         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4804                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4805                         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
4806         return node_id_arr;
4807 }
4808 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
4809         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4810         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4811                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
4812                         uint64_t msg_ref = 0;
4813                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4814                         msg_ref = tag_ptr(msg_var.inner, false);
4815         return msg_ref;
4816 }
4817 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
4818         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4819         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4820                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4821                         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
4822         return node_id_arr;
4823 }
4824 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
4825         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4826         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4827                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
4828                         uint64_t msg_ref = 0;
4829                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4830                         msg_ref = tag_ptr(msg_var.inner, false);
4831         return msg_ref;
4832 }
4833 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
4834         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4835         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4836                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4837                         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
4838         return node_id_arr;
4839 }
4840 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
4841         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4842         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4843                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
4844                         uint64_t msg_ref = 0;
4845                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4846                         msg_ref = tag_ptr(msg_var.inner, false);
4847         return msg_ref;
4848 }
4849 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
4850         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4851         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4852                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4853                         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
4854         return node_id_arr;
4855 }
4856 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
4857         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4858         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4859                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
4860                         uint64_t msg_ref = 0;
4861                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4862                         msg_ref = tag_ptr(msg_var.inner, false);
4863         return msg_ref;
4864 }
4865 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
4866         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4867         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4868                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4869                         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4870         return node_id_arr;
4871 }
4872 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
4873         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4874         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4875                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4876                         uint64_t msg_ref = 0;
4877                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4878                         msg_ref = tag_ptr(msg_var.inner, false);
4879         return msg_ref;
4880 }
4881 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
4882         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4883         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4884                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4885                         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4886         return node_id_arr;
4887 }
4888 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
4889         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4890         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4891                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4892                         uint64_t msg_ref = 0;
4893                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4894                         msg_ref = tag_ptr(msg_var.inner, false);
4895         return msg_ref;
4896 }
4897 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
4898         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4899         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4900                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4901                         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4902         return node_id_arr;
4903 }
4904 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
4905         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4906         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4907                         LDKTxAddInput msg_var = obj->send_tx_abort.msg;
4908                         uint64_t msg_ref = 0;
4909                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4910                         msg_ref = tag_ptr(msg_var.inner, false);
4911         return msg_ref;
4912 }
4913 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
4914         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4915         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4916                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4917                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4918         return node_id_arr;
4919 }
4920 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
4921         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4922         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4923                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4924                         uint64_t msg_ref = 0;
4925                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4926                         msg_ref = tag_ptr(msg_var.inner, false);
4927         return msg_ref;
4928 }
4929 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
4930         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4931         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4932                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4933                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4934         return node_id_arr;
4935 }
4936 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
4937         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4938         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4939                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4940                         uint64_t msg_ref = 0;
4941                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4942                         msg_ref = tag_ptr(msg_var.inner, false);
4943         return msg_ref;
4944 }
4945 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
4946         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4947         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4948                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4949                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4950         return node_id_arr;
4951 }
4952 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
4953         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4954         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4955                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4956                         uint64_t updates_ref = 0;
4957                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4958                         updates_ref = tag_ptr(updates_var.inner, false);
4959         return updates_ref;
4960 }
4961 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
4962         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4963         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4964                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4965                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4966         return node_id_arr;
4967 }
4968 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
4969         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4970         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4971                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4972                         uint64_t msg_ref = 0;
4973                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4974                         msg_ref = tag_ptr(msg_var.inner, false);
4975         return msg_ref;
4976 }
4977 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
4978         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4979         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4980                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4981                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4982         return node_id_arr;
4983 }
4984 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
4985         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4986         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4987                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4988                         uint64_t msg_ref = 0;
4989                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4990                         msg_ref = tag_ptr(msg_var.inner, false);
4991         return msg_ref;
4992 }
4993 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
4994         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4995         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4996                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4997                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4998         return node_id_arr;
4999 }
5000 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
5001         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5002         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
5003                         LDKShutdown msg_var = obj->send_shutdown.msg;
5004                         uint64_t msg_ref = 0;
5005                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5006                         msg_ref = tag_ptr(msg_var.inner, false);
5007         return msg_ref;
5008 }
5009 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
5010         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5011         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
5012                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5013                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
5014         return node_id_arr;
5015 }
5016 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
5017         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5018         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
5019                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
5020                         uint64_t msg_ref = 0;
5021                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5022                         msg_ref = tag_ptr(msg_var.inner, false);
5023         return msg_ref;
5024 }
5025 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
5026         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5027         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5028                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5029                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
5030         return node_id_arr;
5031 }
5032 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
5033         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5034         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5035                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
5036                         uint64_t msg_ref = 0;
5037                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5038                         msg_ref = tag_ptr(msg_var.inner, false);
5039         return msg_ref;
5040 }
5041 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
5042         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5043         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5044                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
5045                         uint64_t update_msg_ref = 0;
5046                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
5047                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
5048         return update_msg_ref;
5049 }
5050 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
5051         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5052         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
5053                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
5054                         uint64_t msg_ref = 0;
5055                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5056                         msg_ref = tag_ptr(msg_var.inner, false);
5057         return msg_ref;
5058 }
5059 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
5060         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5061         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
5062                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
5063                         uint64_t update_msg_ref = 0;
5064                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
5065                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
5066         return update_msg_ref;
5067 }
5068 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
5069         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5070         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
5071                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
5072                         uint64_t msg_ref = 0;
5073                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5074                         msg_ref = tag_ptr(msg_var.inner, false);
5075         return msg_ref;
5076 }
5077 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
5078         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5079         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
5080                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
5081                         uint64_t msg_ref = 0;
5082                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5083                         msg_ref = tag_ptr(msg_var.inner, false);
5084         return msg_ref;
5085 }
5086 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
5087         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5088         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
5089                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5090                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
5091         return node_id_arr;
5092 }
5093 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
5094         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5095         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
5096                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
5097                         uint64_t msg_ref = 0;
5098                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5099                         msg_ref = tag_ptr(msg_var.inner, false);
5100         return msg_ref;
5101 }
5102 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
5103         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5104         assert(obj->tag == LDKMessageSendEvent_HandleError);
5105                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5106                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
5107         return node_id_arr;
5108 }
5109 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
5110         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5111         assert(obj->tag == LDKMessageSendEvent_HandleError);
5112                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
5113         return action_ref;
5114 }
5115 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
5116         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5117         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
5118                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5119                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
5120         return node_id_arr;
5121 }
5122 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
5123         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5124         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
5125                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
5126                         uint64_t msg_ref = 0;
5127                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5128                         msg_ref = tag_ptr(msg_var.inner, false);
5129         return msg_ref;
5130 }
5131 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
5132         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5133         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
5134                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5135                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
5136         return node_id_arr;
5137 }
5138 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
5139         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5140         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
5141                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
5142                         uint64_t msg_ref = 0;
5143                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5144                         msg_ref = tag_ptr(msg_var.inner, false);
5145         return msg_ref;
5146 }
5147 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
5148         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5149         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
5150                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5151                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
5152         return node_id_arr;
5153 }
5154 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
5155         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5156         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
5157                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
5158                         uint64_t msg_ref = 0;
5159                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5160                         msg_ref = tag_ptr(msg_var.inner, false);
5161         return msg_ref;
5162 }
5163 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
5164         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5165         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
5166                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5167                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
5168         return node_id_arr;
5169 }
5170 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
5171         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5172         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
5173                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
5174                         uint64_t msg_ref = 0;
5175                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5176                         msg_ref = tag_ptr(msg_var.inner, false);
5177         return msg_ref;
5178 }
5179 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
5180         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
5181         for (size_t i = 0; i < ret.datalen; i++) {
5182                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
5183         }
5184         return ret;
5185 }
5186 static inline LDKCVec_ChainHashZ CVec_ChainHashZ_clone(const LDKCVec_ChainHashZ *orig) {
5187         LDKCVec_ChainHashZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ChainHashZ clone bytes"), .datalen = orig->datalen };
5188         for (size_t i = 0; i < ret.datalen; i++) {
5189                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5190         }
5191         return ret;
5192 }
5193 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5194         LDKOffer ret = *owner->contents.result;
5195         ret.is_owned = false;
5196         return ret;
5197 }
5198 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
5199         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5200         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5201         uint64_t ret_ref = 0;
5202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5204         return ret_ref;
5205 }
5206
5207 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5208         LDKBolt12ParseError ret = *owner->contents.err;
5209         ret.is_owned = false;
5210         return ret;
5211 }
5212 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
5213         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5214         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5215         uint64_t ret_ref = 0;
5216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5218         return ret_ref;
5219 }
5220
5221 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5222 CHECK(owner->result_ok);
5223         return *owner->contents.result;
5224 }
5225 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
5226         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5227         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5228         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
5229         return ret_arr;
5230 }
5231
5232 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5233 CHECK(!owner->result_ok);
5234         return *owner->contents.err;
5235 }
5236 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
5237         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5238         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
5239         return ret_conv;
5240 }
5241
5242 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5243         LDKNodeId ret = *owner->contents.result;
5244         ret.is_owned = false;
5245         return ret;
5246 }
5247 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
5248         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5249         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5250         uint64_t ret_ref = 0;
5251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5253         return ret_ref;
5254 }
5255
5256 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5257 CHECK(!owner->result_ok);
5258         return DecodeError_clone(&*owner->contents.err);
5259 }
5260 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
5261         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5263         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5264         uint64_t ret_ref = tag_ptr(ret_copy, true);
5265         return ret_ref;
5266 }
5267
5268 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5269 CHECK(owner->result_ok);
5270         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5271 }
5272 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
5273         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5274         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5275         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5276         uint64_t ret_ref = tag_ptr(ret_copy, true);
5277         return ret_ref;
5278 }
5279
5280 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5281 CHECK(!owner->result_ok);
5282         return DecodeError_clone(&*owner->contents.err);
5283 }
5284 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
5285         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5286         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5287         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5288         uint64_t ret_ref = tag_ptr(ret_copy, true);
5289         return ret_ref;
5290 }
5291
5292 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5293 CHECK(owner->result_ok);
5294         return TxOut_clone(&*owner->contents.result);
5295 }
5296 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
5297         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5298         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5299         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5300         return tag_ptr(ret_ref, true);
5301 }
5302
5303 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5304 CHECK(!owner->result_ok);
5305         return UtxoLookupError_clone(&*owner->contents.err);
5306 }
5307 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
5308         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5309         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5310         return ret_conv;
5311 }
5312
5313 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
5314         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5315         switch(obj->tag) {
5316                 case LDKUtxoResult_Sync: return 0;
5317                 case LDKUtxoResult_Async: return 1;
5318                 default: abort();
5319         }
5320 }
5321 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
5322         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5323         assert(obj->tag == LDKUtxoResult_Sync);
5324                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5325                         *sync_conv = obj->sync;
5326                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5327         return tag_ptr(sync_conv, true);
5328 }
5329 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
5330         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5331         assert(obj->tag == LDKUtxoResult_Async);
5332                         LDKUtxoFuture async_var = obj->async;
5333                         uint64_t async_ref = 0;
5334                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5335                         async_ref = tag_ptr(async_var.inner, false);
5336         return async_ref;
5337 }
5338 typedef struct LDKUtxoLookup_JCalls {
5339         atomic_size_t refcnt;
5340         uint32_t instance_ptr;
5341 } LDKUtxoLookup_JCalls;
5342 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5343         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5344         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5345                 FREE(j_calls);
5346         }
5347 }
5348 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5349         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5350         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
5351         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
5352         int64_t short_channel_id_conv = short_channel_id;
5353         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 17, (uint32_t)genesis_hash_arr, short_channel_id_conv, 0, 0, 0, 0);
5354         void* ret_ptr = untag_ptr(ret);
5355         CHECK_ACCESS(ret_ptr);
5356         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5357         FREE(untag_ptr(ret));
5358         return ret_conv;
5359 }
5360 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5361         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5362         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5363 }
5364 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
5365         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5366         atomic_init(&calls->refcnt, 1);
5367         calls->instance_ptr = o;
5368
5369         LDKUtxoLookup ret = {
5370                 .this_arg = (void*) calls,
5371                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5372                 .free = LDKUtxoLookup_JCalls_free,
5373         };
5374         return ret;
5375 }
5376 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
5377         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5378         *res_ptr = LDKUtxoLookup_init(o);
5379         return tag_ptr(res_ptr, true);
5380 }
5381 uint64_t  __attribute__((export_name("TS_UtxoLookup_get_utxo"))) TS_UtxoLookup_get_utxo(uint64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
5382         void* this_arg_ptr = untag_ptr(this_arg);
5383         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5384         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5385         uint8_t genesis_hash_arr[32];
5386         CHECK(genesis_hash->arr_len == 32);
5387         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
5388         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
5389         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5390         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
5391         uint64_t ret_ref = tag_ptr(ret_copy, true);
5392         return ret_ref;
5393 }
5394
5395 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
5396         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5397         switch(obj->tag) {
5398                 case LDKCOption_UtxoLookupZ_Some: return 0;
5399                 case LDKCOption_UtxoLookupZ_None: return 1;
5400                 default: abort();
5401         }
5402 }
5403 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
5404         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5405         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
5406                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5407                         *some_ret = obj->some;
5408                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5409                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5410                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5411                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5412                         }
5413         return tag_ptr(some_ret, true);
5414 }
5415 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5416 CHECK(owner->result_ok);
5417         return *owner->contents.result;
5418 }
5419 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
5420         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5421         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5422 }
5423
5424 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5425         LDKLightningError ret = *owner->contents.err;
5426         ret.is_owned = false;
5427         return ret;
5428 }
5429 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
5430         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5431         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5432         uint64_t ret_ref = 0;
5433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5435         return ret_ref;
5436 }
5437
5438 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5439 CHECK(owner->result_ok);
5440         return *owner->contents.result;
5441 }
5442 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
5443         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5444         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5445         return ret_conv;
5446 }
5447
5448 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5449         LDKLightningError ret = *owner->contents.err;
5450         ret.is_owned = false;
5451         return ret;
5452 }
5453 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
5454         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5455         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5456         uint64_t ret_ref = 0;
5457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5459         return ret_ref;
5460 }
5461
5462 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5463         LDKChannelAnnouncement ret = owner->a;
5464         ret.is_owned = false;
5465         return ret;
5466 }
5467 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
5468         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5469         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5470         uint64_t ret_ref = 0;
5471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5473         return ret_ref;
5474 }
5475
5476 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5477         LDKChannelUpdate ret = owner->b;
5478         ret.is_owned = false;
5479         return ret;
5480 }
5481 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
5482         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5483         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5484         uint64_t ret_ref = 0;
5485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5487         return ret_ref;
5488 }
5489
5490 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5491         LDKChannelUpdate ret = owner->c;
5492         ret.is_owned = false;
5493         return ret;
5494 }
5495 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
5496         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5497         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5498         uint64_t ret_ref = 0;
5499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5501         return ret_ref;
5502 }
5503
5504 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
5505         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5506         switch(obj->tag) {
5507                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
5508                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
5509                 default: abort();
5510         }
5511 }
5512 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
5513         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5514         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
5515                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5516                         *some_conv = obj->some;
5517                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5518         return tag_ptr(some_conv, true);
5519 }
5520 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5521         LDKChannelUpdateInfo ret = *owner->contents.result;
5522         ret.is_owned = false;
5523         return ret;
5524 }
5525 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
5526         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5527         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
5528         uint64_t ret_ref = 0;
5529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5531         return ret_ref;
5532 }
5533
5534 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5535 CHECK(!owner->result_ok);
5536         return DecodeError_clone(&*owner->contents.err);
5537 }
5538 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
5539         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5540         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5541         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
5542         uint64_t ret_ref = tag_ptr(ret_copy, true);
5543         return ret_ref;
5544 }
5545
5546 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5547         LDKChannelInfo ret = *owner->contents.result;
5548         ret.is_owned = false;
5549         return ret;
5550 }
5551 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
5552         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5553         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
5554         uint64_t ret_ref = 0;
5555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5557         return ret_ref;
5558 }
5559
5560 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5561 CHECK(!owner->result_ok);
5562         return DecodeError_clone(&*owner->contents.err);
5563 }
5564 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
5565         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5566         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5567         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
5568         uint64_t ret_ref = tag_ptr(ret_copy, true);
5569         return ret_ref;
5570 }
5571
5572 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5573         LDKRoutingFees ret = *owner->contents.result;
5574         ret.is_owned = false;
5575         return ret;
5576 }
5577 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
5578         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5579         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
5580         uint64_t ret_ref = 0;
5581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5583         return ret_ref;
5584 }
5585
5586 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5587 CHECK(!owner->result_ok);
5588         return DecodeError_clone(&*owner->contents.err);
5589 }
5590 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
5591         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5593         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
5594         uint64_t ret_ref = tag_ptr(ret_copy, true);
5595         return ret_ref;
5596 }
5597
5598 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
5599         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5600         switch(obj->tag) {
5601                 case LDKNetAddress_IPv4: return 0;
5602                 case LDKNetAddress_IPv6: return 1;
5603                 case LDKNetAddress_OnionV2: return 2;
5604                 case LDKNetAddress_OnionV3: return 3;
5605                 case LDKNetAddress_Hostname: return 4;
5606                 default: abort();
5607         }
5608 }
5609 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
5610         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5611         assert(obj->tag == LDKNetAddress_IPv4);
5612                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
5613                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
5614         return addr_arr;
5615 }
5616 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
5617         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5618         assert(obj->tag == LDKNetAddress_IPv4);
5619                         int16_t port_conv = obj->i_pv4.port;
5620         return port_conv;
5621 }
5622 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
5623         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5624         assert(obj->tag == LDKNetAddress_IPv6);
5625                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
5626                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
5627         return addr_arr;
5628 }
5629 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
5630         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5631         assert(obj->tag == LDKNetAddress_IPv6);
5632                         int16_t port_conv = obj->i_pv6.port;
5633         return port_conv;
5634 }
5635 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
5636         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5637         assert(obj->tag == LDKNetAddress_OnionV2);
5638                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
5639                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
5640         return onion_v2_arr;
5641 }
5642 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
5643         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5644         assert(obj->tag == LDKNetAddress_OnionV3);
5645                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
5646                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
5647         return ed25519_pubkey_arr;
5648 }
5649 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
5650         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5651         assert(obj->tag == LDKNetAddress_OnionV3);
5652                         int16_t checksum_conv = obj->onion_v3.checksum;
5653         return checksum_conv;
5654 }
5655 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
5656         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5657         assert(obj->tag == LDKNetAddress_OnionV3);
5658                         int8_t version_conv = obj->onion_v3.version;
5659         return version_conv;
5660 }
5661 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
5662         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5663         assert(obj->tag == LDKNetAddress_OnionV3);
5664                         int16_t port_conv = obj->onion_v3.port;
5665         return port_conv;
5666 }
5667 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
5668         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5669         assert(obj->tag == LDKNetAddress_Hostname);
5670                         LDKHostname hostname_var = obj->hostname.hostname;
5671                         uint64_t hostname_ref = 0;
5672                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
5673                         hostname_ref = tag_ptr(hostname_var.inner, false);
5674         return hostname_ref;
5675 }
5676 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
5677         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5678         assert(obj->tag == LDKNetAddress_Hostname);
5679                         int16_t port_conv = obj->hostname.port;
5680         return port_conv;
5681 }
5682 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
5683         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
5684         for (size_t i = 0; i < ret.datalen; i++) {
5685                 ret.data[i] = NetAddress_clone(&orig->data[i]);
5686         }
5687         return ret;
5688 }
5689 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5690         LDKNodeAnnouncementInfo ret = *owner->contents.result;
5691         ret.is_owned = false;
5692         return ret;
5693 }
5694 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
5695         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5696         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
5697         uint64_t ret_ref = 0;
5698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5700         return ret_ref;
5701 }
5702
5703 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5704 CHECK(!owner->result_ok);
5705         return DecodeError_clone(&*owner->contents.err);
5706 }
5707 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
5708         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5709         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5710         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
5711         uint64_t ret_ref = tag_ptr(ret_copy, true);
5712         return ret_ref;
5713 }
5714
5715 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5716         LDKNodeAlias ret = *owner->contents.result;
5717         ret.is_owned = false;
5718         return ret;
5719 }
5720 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
5721         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5722         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
5723         uint64_t ret_ref = 0;
5724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5726         return ret_ref;
5727 }
5728
5729 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5730 CHECK(!owner->result_ok);
5731         return DecodeError_clone(&*owner->contents.err);
5732 }
5733 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
5734         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5735         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5736         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
5737         uint64_t ret_ref = tag_ptr(ret_copy, true);
5738         return ret_ref;
5739 }
5740
5741 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5742         LDKNodeInfo ret = *owner->contents.result;
5743         ret.is_owned = false;
5744         return ret;
5745 }
5746 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
5747         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5748         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
5749         uint64_t ret_ref = 0;
5750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5752         return ret_ref;
5753 }
5754
5755 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5756 CHECK(!owner->result_ok);
5757         return DecodeError_clone(&*owner->contents.err);
5758 }
5759 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
5760         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5761         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5762         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
5763         uint64_t ret_ref = tag_ptr(ret_copy, true);
5764         return ret_ref;
5765 }
5766
5767 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5768         LDKNetworkGraph ret = *owner->contents.result;
5769         ret.is_owned = false;
5770         return ret;
5771 }
5772 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
5773         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5774         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5775         uint64_t ret_ref = 0;
5776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5778         return ret_ref;
5779 }
5780
5781 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5782 CHECK(!owner->result_ok);
5783         return DecodeError_clone(&*owner->contents.err);
5784 }
5785 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
5786         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5787         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5788         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5789         uint64_t ret_ref = tag_ptr(ret_copy, true);
5790         return ret_ref;
5791 }
5792
5793 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
5794         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
5795         switch(obj->tag) {
5796                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
5797                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
5798                 default: abort();
5799         }
5800 }
5801 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
5802         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
5803         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
5804                         LDKCVec_NetAddressZ some_var = obj->some;
5805                         uint64_tArray some_arr = NULL;
5806                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
5807                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
5808                         for (size_t m = 0; m < some_var.datalen; m++) {
5809                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
5810                                 some_arr_ptr[m] = some_conv_12_ref;
5811                         }
5812                         
5813         return some_arr;
5814 }
5815 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5816         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5817         for (size_t i = 0; i < ret.datalen; i++) {
5818                 ret.data[i] = Utxo_clone(&orig->data[i]);
5819         }
5820         return ret;
5821 }
5822 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
5823         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5824         switch(obj->tag) {
5825                 case LDKCOption_TxOutZ_Some: return 0;
5826                 case LDKCOption_TxOutZ_None: return 1;
5827                 default: abort();
5828         }
5829 }
5830 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
5831         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5832         assert(obj->tag == LDKCOption_TxOutZ_Some);
5833                         LDKTxOut* some_ref = &obj->some;
5834         return tag_ptr(some_ref, false);
5835 }
5836 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5837         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5838         for (size_t i = 0; i < ret.datalen; i++) {
5839                 ret.data[i] = Input_clone(&orig->data[i]);
5840         }
5841         return ret;
5842 }
5843 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5844         LDKCoinSelection ret = *owner->contents.result;
5845         ret.is_owned = false;
5846         return ret;
5847 }
5848 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
5849         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5850         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5851         uint64_t ret_ref = 0;
5852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5854         return ret_ref;
5855 }
5856
5857 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5858 CHECK(!owner->result_ok);
5859         return *owner->contents.err;
5860 }
5861 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
5862         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5863         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5864 }
5865
5866 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5867 CHECK(owner->result_ok);
5868         return CVec_UtxoZ_clone(&*owner->contents.result);
5869 }
5870 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
5871         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5872         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5873         uint64_tArray ret_arr = NULL;
5874         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5875         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5876         for (size_t g = 0; g < ret_var.datalen; g++) {
5877                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5878                 uint64_t ret_conv_6_ref = 0;
5879                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5880                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5881                 ret_arr_ptr[g] = ret_conv_6_ref;
5882         }
5883         
5884         FREE(ret_var.data);
5885         return ret_arr;
5886 }
5887
5888 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5889 CHECK(!owner->result_ok);
5890         return *owner->contents.err;
5891 }
5892 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
5893         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5894         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5895 }
5896
5897 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
5898         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
5899         switch(obj->tag) {
5900                 case LDKCOption_u16Z_Some: return 0;
5901                 case LDKCOption_u16Z_None: return 1;
5902                 default: abort();
5903         }
5904 }
5905 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
5906         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
5907         assert(obj->tag == LDKCOption_u16Z_Some);
5908                         int16_t some_conv = obj->some;
5909         return some_conv;
5910 }
5911 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
5912         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5913         switch(obj->tag) {
5914                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
5915                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
5916                 default: abort();
5917         }
5918 }
5919 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
5920         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5921         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
5922                         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
5923         return some_conv;
5924 }
5925 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5926 CHECK(owner->result_ok);
5927         return ThirtyTwoBytes_clone(&*owner->contents.result);
5928 }
5929 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
5930         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5931         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5932         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
5933         return ret_arr;
5934 }
5935
5936 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5937 CHECK(!owner->result_ok);
5938         return APIError_clone(&*owner->contents.err);
5939 }
5940 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
5941         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5942         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5943         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5944         uint64_t ret_ref = tag_ptr(ret_copy, true);
5945         return ret_ref;
5946 }
5947
5948 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
5949         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5950         switch(obj->tag) {
5951                 case LDKRecentPaymentDetails_Pending: return 0;
5952                 case LDKRecentPaymentDetails_Fulfilled: return 1;
5953                 case LDKRecentPaymentDetails_Abandoned: return 2;
5954                 default: abort();
5955         }
5956 }
5957 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
5958         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5959         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5960                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5961                         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5962         return payment_hash_arr;
5963 }
5964 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
5965         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5966         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5967                         int64_t total_msat_conv = obj->pending.total_msat;
5968         return total_msat_conv;
5969 }
5970 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
5971         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5972         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5973                         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
5974         return payment_hash_ref;
5975 }
5976 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
5977         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5978         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5979                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5980                         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5981         return payment_hash_arr;
5982 }
5983 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5984         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5985         for (size_t i = 0; i < ret.datalen; i++) {
5986                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5987         }
5988         return ret;
5989 }
5990 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
5991         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5992         switch(obj->tag) {
5993                 case LDKPaymentSendFailure_ParameterError: return 0;
5994                 case LDKPaymentSendFailure_PathParameterError: return 1;
5995                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5996                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5997                 case LDKPaymentSendFailure_PartialFailure: return 4;
5998                 default: abort();
5999         }
6000 }
6001 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
6002         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6003         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
6004                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
6005         return parameter_error_ref;
6006 }
6007 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
6008         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6009         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
6010                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6011                         uint64_tArray path_parameter_error_arr = NULL;
6012                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
6013                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
6014                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6015                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6016                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6017                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6018                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
6019                         }
6020                         
6021         return path_parameter_error_arr;
6022 }
6023 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
6024         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6025         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
6026                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
6027                         uint64_tArray all_failed_resend_safe_arr = NULL;
6028                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
6029                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
6030                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
6031                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
6032                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
6033                         }
6034                         
6035         return all_failed_resend_safe_arr;
6036 }
6037 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
6038         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6039         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6040                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6041                         uint64_tArray results_arr = NULL;
6042                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
6043                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
6044                         for (size_t w = 0; w < results_var.datalen; w++) {
6045                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6046                                 *results_conv_22_conv = results_var.data[w];
6047                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6048                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
6049                         }
6050                         
6051         return results_arr;
6052 }
6053 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
6054         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6055         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6056                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6057                         uint64_t failed_paths_retry_ref = 0;
6058                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6059                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
6060         return failed_paths_retry_ref;
6061 }
6062 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
6063         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6064         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6065                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6066                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
6067         return payment_id_arr;
6068 }
6069 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6070 CHECK(owner->result_ok);
6071         return *owner->contents.result;
6072 }
6073 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
6074         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6075         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6076 }
6077
6078 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6079 CHECK(!owner->result_ok);
6080         return PaymentSendFailure_clone(&*owner->contents.err);
6081 }
6082 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
6083         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6084         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6085         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6086         uint64_t ret_ref = tag_ptr(ret_copy, true);
6087         return ret_ref;
6088 }
6089
6090 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6091 CHECK(owner->result_ok);
6092         return *owner->contents.result;
6093 }
6094 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
6095         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6096         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
6097 }
6098
6099 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6100 CHECK(!owner->result_ok);
6101         return RetryableSendFailure_clone(&*owner->contents.err);
6102 }
6103 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
6104         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6105         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
6106         return ret_conv;
6107 }
6108
6109 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6110 CHECK(owner->result_ok);
6111         return ThirtyTwoBytes_clone(&*owner->contents.result);
6112 }
6113 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) {
6114         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6115         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6116         memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32);
6117         return ret_arr;
6118 }
6119
6120 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6121 CHECK(!owner->result_ok);
6122         return PaymentSendFailure_clone(&*owner->contents.err);
6123 }
6124 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) {
6125         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6126         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6127         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
6128         uint64_t ret_ref = tag_ptr(ret_copy, true);
6129         return ret_ref;
6130 }
6131
6132 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
6133 CHECK(owner->result_ok);
6134         return ThirtyTwoBytes_clone(&*owner->contents.result);
6135 }
6136 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_ok(uint64_t owner) {
6137         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
6138         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6139         memcpy(ret_arr->elems, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data, 32);
6140         return ret_arr;
6141 }
6142
6143 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
6144 CHECK(!owner->result_ok);
6145         return RetryableSendFailure_clone(&*owner->contents.err);
6146 }
6147 uint32_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_err(uint64_t owner) {
6148         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
6149         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
6150         return ret_conv;
6151 }
6152
6153 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6154         return ThirtyTwoBytes_clone(&owner->a);
6155 }
6156 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
6157         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6158         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6159         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
6160         return ret_arr;
6161 }
6162
6163 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6164         return ThirtyTwoBytes_clone(&owner->b);
6165 }
6166 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
6167         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6168         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6169         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
6170         return ret_arr;
6171 }
6172
6173 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6174 CHECK(owner->result_ok);
6175         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6176 }
6177 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
6178         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6179         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6180         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6181         return tag_ptr(ret_conv, true);
6182 }
6183
6184 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6185 CHECK(!owner->result_ok);
6186         return PaymentSendFailure_clone(&*owner->contents.err);
6187 }
6188 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
6189         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6190         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6191         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6192         uint64_t ret_ref = tag_ptr(ret_copy, true);
6193         return ret_ref;
6194 }
6195
6196 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
6197         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
6198         for (size_t i = 0; i < ret.datalen; i++) {
6199                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
6200         }
6201         return ret;
6202 }
6203 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6204         return ThirtyTwoBytes_clone(&owner->a);
6205 }
6206 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
6207         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6208         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6209         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
6210         return ret_arr;
6211 }
6212
6213 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6214         return ThirtyTwoBytes_clone(&owner->b);
6215 }
6216 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
6217         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6218         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6219         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
6220         return ret_arr;
6221 }
6222
6223 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6224 CHECK(owner->result_ok);
6225         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6226 }
6227 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
6228         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6229         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6230         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6231         return tag_ptr(ret_conv, true);
6232 }
6233
6234 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6235 CHECK(!owner->result_ok);
6236         return *owner->contents.err;
6237 }
6238 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
6239         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6240         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6241 }
6242
6243 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6244 CHECK(owner->result_ok);
6245         return ThirtyTwoBytes_clone(&*owner->contents.result);
6246 }
6247 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
6248         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6249         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6250         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
6251         return ret_arr;
6252 }
6253
6254 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6255 CHECK(!owner->result_ok);
6256         return *owner->contents.err;
6257 }
6258 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
6259         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6260         CResult_PaymentSecretNoneZ_get_err(owner_conv);
6261 }
6262
6263 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6264 CHECK(owner->result_ok);
6265         return ThirtyTwoBytes_clone(&*owner->contents.result);
6266 }
6267 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
6268         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
6269         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6270         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
6271         return ret_arr;
6272 }
6273
6274 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6275 CHECK(!owner->result_ok);
6276         return APIError_clone(&*owner->contents.err);
6277 }
6278 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
6279         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
6280         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6281         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6282         uint64_t ret_ref = tag_ptr(ret_copy, true);
6283         return ret_ref;
6284 }
6285
6286 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ChainHashZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ChainHashZZ_ty_from_ptr(uint64_t ptr) {
6287         LDKCOption_CVec_ChainHashZZ *obj = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(ptr);
6288         switch(obj->tag) {
6289                 case LDKCOption_CVec_ChainHashZZ_Some: return 0;
6290                 case LDKCOption_CVec_ChainHashZZ_None: return 1;
6291                 default: abort();
6292         }
6293 }
6294 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ChainHashZZ_Some_get_some"))) TS_LDKCOption_CVec_ChainHashZZ_Some_get_some(uint64_t ptr) {
6295         LDKCOption_CVec_ChainHashZZ *obj = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(ptr);
6296         assert(obj->tag == LDKCOption_CVec_ChainHashZZ_Some);
6297                         LDKCVec_ChainHashZ some_var = obj->some;
6298                         ptrArray some_arr = NULL;
6299                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
6300                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
6301                         for (size_t m = 0; m < some_var.datalen; m++) {
6302                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
6303                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
6304                                 some_arr_ptr[m] = some_conv_12_arr;
6305                         }
6306                         
6307         return some_arr;
6308 }
6309 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6310         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
6311         ret.is_owned = false;
6312         return ret;
6313 }
6314 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
6315         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6316         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
6317         uint64_t ret_ref = 0;
6318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6320         return ret_ref;
6321 }
6322
6323 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6324 CHECK(!owner->result_ok);
6325         return DecodeError_clone(&*owner->contents.err);
6326 }
6327 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
6328         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6329         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6330         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6331         uint64_t ret_ref = tag_ptr(ret_copy, true);
6332         return ret_ref;
6333 }
6334
6335 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6336         LDKChannelCounterparty ret = *owner->contents.result;
6337         ret.is_owned = false;
6338         return ret;
6339 }
6340 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
6341         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6342         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6343         uint64_t ret_ref = 0;
6344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6346         return ret_ref;
6347 }
6348
6349 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6350 CHECK(!owner->result_ok);
6351         return DecodeError_clone(&*owner->contents.err);
6352 }
6353 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
6354         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6355         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6356         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6357         uint64_t ret_ref = tag_ptr(ret_copy, true);
6358         return ret_ref;
6359 }
6360
6361 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6362         LDKChannelDetails ret = *owner->contents.result;
6363         ret.is_owned = false;
6364         return ret;
6365 }
6366 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
6367         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6368         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6369         uint64_t ret_ref = 0;
6370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6372         return ret_ref;
6373 }
6374
6375 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6376 CHECK(!owner->result_ok);
6377         return DecodeError_clone(&*owner->contents.err);
6378 }
6379 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
6380         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6381         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6382         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6383         uint64_t ret_ref = tag_ptr(ret_copy, true);
6384         return ret_ref;
6385 }
6386
6387 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6388         LDKPhantomRouteHints ret = *owner->contents.result;
6389         ret.is_owned = false;
6390         return ret;
6391 }
6392 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
6393         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6394         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6395         uint64_t ret_ref = 0;
6396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6398         return ret_ref;
6399 }
6400
6401 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6402 CHECK(!owner->result_ok);
6403         return DecodeError_clone(&*owner->contents.err);
6404 }
6405 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
6406         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6407         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6408         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6409         uint64_t ret_ref = tag_ptr(ret_copy, true);
6410         return ret_ref;
6411 }
6412
6413 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6414 CHECK(owner->result_ok);
6415         return ChannelShutdownState_clone(&*owner->contents.result);
6416 }
6417 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
6418         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6419         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
6420         return ret_conv;
6421 }
6422
6423 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6424 CHECK(!owner->result_ok);
6425         return DecodeError_clone(&*owner->contents.err);
6426 }
6427 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
6428         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6429         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6430         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
6431         uint64_t ret_ref = tag_ptr(ret_copy, true);
6432         return ret_ref;
6433 }
6434
6435 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6436         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6437         for (size_t i = 0; i < ret.datalen; i++) {
6438                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6439         }
6440         return ret;
6441 }
6442 typedef struct LDKWatch_JCalls {
6443         atomic_size_t refcnt;
6444         uint32_t instance_ptr;
6445 } LDKWatch_JCalls;
6446 static void LDKWatch_JCalls_free(void* this_arg) {
6447         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6448         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6449                 FREE(j_calls);
6450         }
6451 }
6452 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6453         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6454         LDKOutPoint funding_txo_var = funding_txo;
6455         uint64_t funding_txo_ref = 0;
6456         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6457         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6458         LDKChannelMonitor monitor_var = monitor;
6459         uint64_t monitor_ref = 0;
6460         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6461         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6462         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
6463         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
6464         return ret_conv;
6465 }
6466 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6467         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6468         LDKOutPoint funding_txo_var = funding_txo;
6469         uint64_t funding_txo_ref = 0;
6470         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6471         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6472         LDKChannelMonitorUpdate update_var = *update;
6473         uint64_t update_ref = 0;
6474         update_var = ChannelMonitorUpdate_clone(&update_var);
6475         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6476         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6477         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
6478         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
6479         return ret_conv;
6480 }
6481 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6482         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6483         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
6484         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6485         ret_constr.datalen = ret->arr_len;
6486         if (ret_constr.datalen > 0)
6487                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6488         else
6489                 ret_constr.data = NULL;
6490         uint64_t* ret_vals = ret->elems;
6491         for (size_t x = 0; x < ret_constr.datalen; x++) {
6492                 uint64_t ret_conv_49 = ret_vals[x];
6493                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
6494                 CHECK_ACCESS(ret_conv_49_ptr);
6495                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6496                 FREE(untag_ptr(ret_conv_49));
6497                 ret_constr.data[x] = ret_conv_49_conv;
6498         }
6499         FREE(ret);
6500         return ret_constr;
6501 }
6502 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6503         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6504         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6505 }
6506 static inline LDKWatch LDKWatch_init (JSValue o) {
6507         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6508         atomic_init(&calls->refcnt, 1);
6509         calls->instance_ptr = o;
6510
6511         LDKWatch ret = {
6512                 .this_arg = (void*) calls,
6513                 .watch_channel = watch_channel_LDKWatch_jcall,
6514                 .update_channel = update_channel_LDKWatch_jcall,
6515                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6516                 .free = LDKWatch_JCalls_free,
6517         };
6518         return ret;
6519 }
6520 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
6521         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6522         *res_ptr = LDKWatch_init(o);
6523         return tag_ptr(res_ptr, true);
6524 }
6525 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
6526         void* this_arg_ptr = untag_ptr(this_arg);
6527         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6528         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6529         LDKOutPoint funding_txo_conv;
6530         funding_txo_conv.inner = untag_ptr(funding_txo);
6531         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6532         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6533         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6534         LDKChannelMonitor monitor_conv;
6535         monitor_conv.inner = untag_ptr(monitor);
6536         monitor_conv.is_owned = ptr_is_owned(monitor);
6537         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6538         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6539         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
6540         return ret_conv;
6541 }
6542
6543 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
6544         void* this_arg_ptr = untag_ptr(this_arg);
6545         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6546         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6547         LDKOutPoint funding_txo_conv;
6548         funding_txo_conv.inner = untag_ptr(funding_txo);
6549         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6550         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6551         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6552         LDKChannelMonitorUpdate update_conv;
6553         update_conv.inner = untag_ptr(update);
6554         update_conv.is_owned = ptr_is_owned(update);
6555         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6556         update_conv.is_owned = false;
6557         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
6558         return ret_conv;
6559 }
6560
6561 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
6562         void* this_arg_ptr = untag_ptr(this_arg);
6563         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6564         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6565         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6566         uint64_tArray ret_arr = NULL;
6567         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6568         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6569         for (size_t x = 0; x < ret_var.datalen; x++) {
6570                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6571                 *ret_conv_49_conv = ret_var.data[x];
6572                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
6573         }
6574         
6575         FREE(ret_var.data);
6576         return ret_arr;
6577 }
6578
6579 typedef struct LDKBroadcasterInterface_JCalls {
6580         atomic_size_t refcnt;
6581         uint32_t instance_ptr;
6582 } LDKBroadcasterInterface_JCalls;
6583 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6584         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6585         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6586                 FREE(j_calls);
6587         }
6588 }
6589 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
6590         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6591         LDKCVec_TransactionZ txs_var = txs;
6592         ptrArray txs_arr = NULL;
6593         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
6594         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
6595         for (size_t m = 0; m < txs_var.datalen; m++) {
6596                 LDKTransaction txs_conv_12_var = txs_var.data[m];
6597                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
6598                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
6599                 Transaction_free(txs_conv_12_var);
6600                 txs_arr_ptr[m] = txs_conv_12_arr;
6601         }
6602         
6603         FREE(txs_var.data);
6604         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
6605 }
6606 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6607         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6608         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6609 }
6610 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
6611         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6612         atomic_init(&calls->refcnt, 1);
6613         calls->instance_ptr = o;
6614
6615         LDKBroadcasterInterface ret = {
6616                 .this_arg = (void*) calls,
6617                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
6618                 .free = LDKBroadcasterInterface_JCalls_free,
6619         };
6620         return ret;
6621 }
6622 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
6623         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6624         *res_ptr = LDKBroadcasterInterface_init(o);
6625         return tag_ptr(res_ptr, true);
6626 }
6627 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
6628         void* this_arg_ptr = untag_ptr(this_arg);
6629         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6630         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6631         LDKCVec_TransactionZ txs_constr;
6632         txs_constr.datalen = txs->arr_len;
6633         if (txs_constr.datalen > 0)
6634                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6635         else
6636                 txs_constr.data = NULL;
6637         int8_tArray* txs_vals = (void*) txs->elems;
6638         for (size_t m = 0; m < txs_constr.datalen; m++) {
6639                 int8_tArray txs_conv_12 = txs_vals[m];
6640                 LDKTransaction txs_conv_12_ref;
6641                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
6642                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
6643                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
6644                 txs_conv_12_ref.data_is_owned = true;
6645                 txs_constr.data[m] = txs_conv_12_ref;
6646         }
6647         FREE(txs);
6648         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
6649 }
6650
6651 typedef struct LDKEntropySource_JCalls {
6652         atomic_size_t refcnt;
6653         uint32_t instance_ptr;
6654 } LDKEntropySource_JCalls;
6655 static void LDKEntropySource_JCalls_free(void* this_arg) {
6656         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6657         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6658                 FREE(j_calls);
6659         }
6660 }
6661 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
6662         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6663         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
6664         LDKThirtyTwoBytes ret_ref;
6665         CHECK(ret->arr_len == 32);
6666         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6667         return ret_ref;
6668 }
6669 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
6670         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
6671         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6672 }
6673 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
6674         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
6675         atomic_init(&calls->refcnt, 1);
6676         calls->instance_ptr = o;
6677
6678         LDKEntropySource ret = {
6679                 .this_arg = (void*) calls,
6680                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
6681                 .free = LDKEntropySource_JCalls_free,
6682         };
6683         return ret;
6684 }
6685 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
6686         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
6687         *res_ptr = LDKEntropySource_init(o);
6688         return tag_ptr(res_ptr, true);
6689 }
6690 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
6691         void* this_arg_ptr = untag_ptr(this_arg);
6692         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6693         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
6694         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6695         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6696         return ret_arr;
6697 }
6698
6699 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
6700         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6701         switch(obj->tag) {
6702                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
6703                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
6704                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
6705                 default: abort();
6706         }
6707 }
6708 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
6709         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6710         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
6711                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
6712                         uint64_t channel_announcement_ref = 0;
6713                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
6714                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
6715         return channel_announcement_ref;
6716 }
6717 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
6718         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6719         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
6720                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
6721                         uint64_t channel_update_ref = 0;
6722                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
6723                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
6724         return channel_update_ref;
6725 }
6726 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
6727         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6728         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
6729                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
6730                         uint64_t node_announcement_ref = 0;
6731                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
6732                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
6733         return node_announcement_ref;
6734 }
6735 typedef struct LDKNodeSigner_JCalls {
6736         atomic_size_t refcnt;
6737         uint32_t instance_ptr;
6738 } LDKNodeSigner_JCalls;
6739 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6740         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6741         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6742                 FREE(j_calls);
6743         }
6744 }
6745 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6746         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6747         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
6748         LDKThirtyTwoBytes ret_ref;
6749         CHECK(ret->arr_len == 32);
6750         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6751         return ret_ref;
6752 }
6753 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6754         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6755         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6756         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
6757         void* ret_ptr = untag_ptr(ret);
6758         CHECK_ACCESS(ret_ptr);
6759         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6760         FREE(untag_ptr(ret));
6761         return ret_conv;
6762 }
6763 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
6764         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6765         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6766         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6767         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6768         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
6769         *tweak_copy = tweak;
6770         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
6771         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
6772         void* ret_ptr = untag_ptr(ret);
6773         CHECK_ACCESS(ret_ptr);
6774         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
6775         FREE(untag_ptr(ret));
6776         return ret_conv;
6777 }
6778 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6779         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6780         LDKu8slice hrp_bytes_var = hrp_bytes;
6781         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6782         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6783         LDKCVec_U5Z invoice_data_var = invoice_data;
6784         ptrArray invoice_data_arr = NULL;
6785         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6786         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6787         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6788                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6789                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6790         }
6791         
6792         FREE(invoice_data_var.data);
6793         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6794         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);
6795         void* ret_ptr = untag_ptr(ret);
6796         CHECK_ACCESS(ret_ptr);
6797         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6798         FREE(untag_ptr(ret));
6799         return ret_conv;
6800 }
6801 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6802         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6803         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6804         *msg_copy = msg;
6805         uint64_t msg_ref = tag_ptr(msg_copy, true);
6806         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, msg_ref, 0, 0, 0, 0, 0);
6807         void* ret_ptr = untag_ptr(ret);
6808         CHECK_ACCESS(ret_ptr);
6809         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
6810         FREE(untag_ptr(ret));
6811         return ret_conv;
6812 }
6813 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6814         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6815         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6816 }
6817 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
6818         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6819         atomic_init(&calls->refcnt, 1);
6820         calls->instance_ptr = o;
6821
6822         LDKNodeSigner ret = {
6823                 .this_arg = (void*) calls,
6824                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6825                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6826                 .ecdh = ecdh_LDKNodeSigner_jcall,
6827                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6828                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6829                 .free = LDKNodeSigner_JCalls_free,
6830         };
6831         return ret;
6832 }
6833 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
6834         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6835         *res_ptr = LDKNodeSigner_init(o);
6836         return tag_ptr(res_ptr, true);
6837 }
6838 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
6839         void* this_arg_ptr = untag_ptr(this_arg);
6840         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6841         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6842         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6843         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6844         return ret_arr;
6845 }
6846
6847 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
6848         void* this_arg_ptr = untag_ptr(this_arg);
6849         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6850         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6851         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6852         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6853         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6854         return tag_ptr(ret_conv, true);
6855 }
6856
6857 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) {
6858         void* this_arg_ptr = untag_ptr(this_arg);
6859         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6860         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6861         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6862         LDKPublicKey other_key_ref;
6863         CHECK(other_key->arr_len == 33);
6864         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6865         void* tweak_ptr = untag_ptr(tweak);
6866         CHECK_ACCESS(tweak_ptr);
6867         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
6868         tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak));
6869         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
6870         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6871         return tag_ptr(ret_conv, true);
6872 }
6873
6874 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) {
6875         void* this_arg_ptr = untag_ptr(this_arg);
6876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6877         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6878         LDKu8slice hrp_bytes_ref;
6879         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6880         hrp_bytes_ref.data = hrp_bytes->elems;
6881         LDKCVec_U5Z invoice_data_constr;
6882         invoice_data_constr.datalen = invoice_data->arr_len;
6883         if (invoice_data_constr.datalen > 0)
6884                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6885         else
6886                 invoice_data_constr.data = NULL;
6887         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6888         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6889                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6890                 
6891                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6892         }
6893         FREE(invoice_data);
6894         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6895         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6896         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6897         FREE(hrp_bytes);
6898         return tag_ptr(ret_conv, true);
6899 }
6900
6901 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
6902         void* this_arg_ptr = untag_ptr(this_arg);
6903         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6904         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6905         void* msg_ptr = untag_ptr(msg);
6906         CHECK_ACCESS(msg_ptr);
6907         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6908         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6909         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6910         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6911         return tag_ptr(ret_conv, true);
6912 }
6913
6914 typedef struct LDKSignerProvider_JCalls {
6915         atomic_size_t refcnt;
6916         uint32_t instance_ptr;
6917 } LDKSignerProvider_JCalls;
6918 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6919         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6920         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6921                 FREE(j_calls);
6922         }
6923 }
6924 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6925         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6926         jboolean inbound_conv = inbound;
6927         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6928         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6929         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6930         int8_tArray ret = (int8_tArray)js_invoke_function_ubuuuu(j_calls->instance_ptr, 28, inbound_conv, channel_value_satoshis_conv, (uint32_t)user_channel_id_arr, 0, 0, 0);
6931         LDKThirtyTwoBytes ret_ref;
6932         CHECK(ret->arr_len == 32);
6933         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6934         return ret_ref;
6935 }
6936 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6937         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6938         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6939         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6940         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6941         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0);
6942         void* ret_ptr = untag_ptr(ret);
6943         CHECK_ACCESS(ret_ptr);
6944         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6945         FREE(untag_ptr(ret));
6946         return ret_conv;
6947 }
6948 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6949         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6950         LDKu8slice reader_var = reader;
6951         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6952         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6953         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6954         void* ret_ptr = untag_ptr(ret);
6955         CHECK_ACCESS(ret_ptr);
6956         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6957         FREE(untag_ptr(ret));
6958         return ret_conv;
6959 }
6960 LDKCResult_ScriptNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
6961         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6962         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
6963         void* ret_ptr = untag_ptr(ret);
6964         CHECK_ACCESS(ret_ptr);
6965         LDKCResult_ScriptNoneZ ret_conv = *(LDKCResult_ScriptNoneZ*)(ret_ptr);
6966         FREE(untag_ptr(ret));
6967         return ret_conv;
6968 }
6969 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6970         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6971         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, 0, 0, 0, 0, 0, 0);
6972         void* ret_ptr = untag_ptr(ret);
6973         CHECK_ACCESS(ret_ptr);
6974         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6975         FREE(untag_ptr(ret));
6976         return ret_conv;
6977 }
6978 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6979         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6980         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6981 }
6982 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6983         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6984         atomic_init(&calls->refcnt, 1);
6985         calls->instance_ptr = o;
6986
6987         LDKSignerProvider ret = {
6988                 .this_arg = (void*) calls,
6989                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6990                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6991                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6992                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6993                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6994                 .free = LDKSignerProvider_JCalls_free,
6995         };
6996         return ret;
6997 }
6998 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
6999         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
7000         *res_ptr = LDKSignerProvider_init(o);
7001         return tag_ptr(res_ptr, true);
7002 }
7003 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) {
7004         void* this_arg_ptr = untag_ptr(this_arg);
7005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7006         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7007         LDKU128 user_channel_id_ref;
7008         CHECK(user_channel_id->arr_len == 16);
7009         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
7010         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7011         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);
7012         return ret_arr;
7013 }
7014
7015 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) {
7016         void* this_arg_ptr = untag_ptr(this_arg);
7017         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7018         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7019         LDKThirtyTwoBytes channel_keys_id_ref;
7020         CHECK(channel_keys_id->arr_len == 32);
7021         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
7022         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
7023         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
7024         return tag_ptr(ret_ret, true);
7025 }
7026
7027 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
7028         void* this_arg_ptr = untag_ptr(this_arg);
7029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7030         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7031         LDKu8slice reader_ref;
7032         reader_ref.datalen = reader->arr_len;
7033         reader_ref.data = reader->elems;
7034         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
7035         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
7036         FREE(reader);
7037         return tag_ptr(ret_conv, true);
7038 }
7039
7040 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
7041         void* this_arg_ptr = untag_ptr(this_arg);
7042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7043         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7044         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
7045         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
7046         return tag_ptr(ret_conv, true);
7047 }
7048
7049 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
7050         void* this_arg_ptr = untag_ptr(this_arg);
7051         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7052         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7053         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
7054         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7055         return tag_ptr(ret_conv, true);
7056 }
7057
7058 typedef struct LDKFeeEstimator_JCalls {
7059         atomic_size_t refcnt;
7060         uint32_t instance_ptr;
7061 } LDKFeeEstimator_JCalls;
7062 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7063         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7064         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7065                 FREE(j_calls);
7066         }
7067 }
7068 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7069         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7070         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
7071         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, confirmation_target_conv, 0, 0, 0, 0, 0);
7072 }
7073 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7074         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7075         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7076 }
7077 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
7078         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7079         atomic_init(&calls->refcnt, 1);
7080         calls->instance_ptr = o;
7081
7082         LDKFeeEstimator ret = {
7083                 .this_arg = (void*) calls,
7084                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7085                 .free = LDKFeeEstimator_JCalls_free,
7086         };
7087         return ret;
7088 }
7089 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
7090         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7091         *res_ptr = LDKFeeEstimator_init(o);
7092         return tag_ptr(res_ptr, true);
7093 }
7094 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) {
7095         void* this_arg_ptr = untag_ptr(this_arg);
7096         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7097         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7098         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
7099         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7100         return ret_conv;
7101 }
7102
7103 typedef struct LDKRouter_JCalls {
7104         atomic_size_t refcnt;
7105         uint32_t instance_ptr;
7106 } LDKRouter_JCalls;
7107 static void LDKRouter_JCalls_free(void* this_arg) {
7108         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7109         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7110                 FREE(j_calls);
7111         }
7112 }
7113 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7114         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7115         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7116         memcpy(payer_arr->elems, payer.compressed_form, 33);
7117         LDKRouteParameters route_params_var = *route_params;
7118         uint64_t route_params_ref = 0;
7119         route_params_var = RouteParameters_clone(&route_params_var);
7120         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7121         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7122         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7123         uint64_tArray first_hops_arr = NULL;
7124         if (first_hops != NULL) {
7125                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7126                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7127                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7128                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7129                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7130                         uint64_t first_hops_conv_16_ref = 0;
7131                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7132                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7133                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7134                 }
7135         
7136         }
7137         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7138         uint64_t inflight_htlcs_ref = 0;
7139         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7140         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7141         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 34, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0);
7142         void* ret_ptr = untag_ptr(ret);
7143         CHECK_ACCESS(ret_ptr);
7144         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7145         FREE(untag_ptr(ret));
7146         return ret_conv;
7147 }
7148 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) {
7149         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7150         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7151         memcpy(payer_arr->elems, payer.compressed_form, 33);
7152         LDKRouteParameters route_params_var = *route_params;
7153         uint64_t route_params_ref = 0;
7154         route_params_var = RouteParameters_clone(&route_params_var);
7155         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7156         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7157         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7158         uint64_tArray first_hops_arr = NULL;
7159         if (first_hops != NULL) {
7160                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7161                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7162                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7163                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7164                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7165                         uint64_t first_hops_conv_16_ref = 0;
7166                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7167                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7168                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7169                 }
7170         
7171         }
7172         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7173         uint64_t inflight_htlcs_ref = 0;
7174         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7175         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7176         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7177         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7178         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7179         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7180         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 35, (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);
7181         void* ret_ptr = untag_ptr(ret);
7182         CHECK_ACCESS(ret_ptr);
7183         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7184         FREE(untag_ptr(ret));
7185         return ret_conv;
7186 }
7187 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7188         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7189         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7190 }
7191 static inline LDKRouter LDKRouter_init (JSValue o) {
7192         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7193         atomic_init(&calls->refcnt, 1);
7194         calls->instance_ptr = o;
7195
7196         LDKRouter ret = {
7197                 .this_arg = (void*) calls,
7198                 .find_route = find_route_LDKRouter_jcall,
7199                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7200                 .free = LDKRouter_JCalls_free,
7201         };
7202         return ret;
7203 }
7204 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
7205         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7206         *res_ptr = LDKRouter_init(o);
7207         return tag_ptr(res_ptr, true);
7208 }
7209 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) {
7210         void* this_arg_ptr = untag_ptr(this_arg);
7211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7212         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7213         LDKPublicKey payer_ref;
7214         CHECK(payer->arr_len == 33);
7215         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7216         LDKRouteParameters route_params_conv;
7217         route_params_conv.inner = untag_ptr(route_params);
7218         route_params_conv.is_owned = ptr_is_owned(route_params);
7219         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7220         route_params_conv.is_owned = false;
7221         LDKCVec_ChannelDetailsZ first_hops_constr;
7222         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7223         if (first_hops != 0) {
7224                 first_hops_constr.datalen = first_hops->arr_len;
7225                 if (first_hops_constr.datalen > 0)
7226                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7227                 else
7228                         first_hops_constr.data = NULL;
7229                 uint64_t* first_hops_vals = first_hops->elems;
7230                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7231                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7232                         LDKChannelDetails first_hops_conv_16_conv;
7233                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7234                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7235                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7236                         first_hops_conv_16_conv.is_owned = false;
7237                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7238                 }
7239                 FREE(first_hops);
7240                 first_hops_ptr = &first_hops_constr;
7241         }
7242         LDKInFlightHtlcs inflight_htlcs_conv;
7243         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7244         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7245         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7246         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7247         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7248         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7249         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7250         return tag_ptr(ret_conv, true);
7251 }
7252
7253 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) {
7254         void* this_arg_ptr = untag_ptr(this_arg);
7255         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7256         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7257         LDKPublicKey payer_ref;
7258         CHECK(payer->arr_len == 33);
7259         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7260         LDKRouteParameters route_params_conv;
7261         route_params_conv.inner = untag_ptr(route_params);
7262         route_params_conv.is_owned = ptr_is_owned(route_params);
7263         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7264         route_params_conv.is_owned = false;
7265         LDKCVec_ChannelDetailsZ first_hops_constr;
7266         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7267         if (first_hops != 0) {
7268                 first_hops_constr.datalen = first_hops->arr_len;
7269                 if (first_hops_constr.datalen > 0)
7270                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7271                 else
7272                         first_hops_constr.data = NULL;
7273                 uint64_t* first_hops_vals = first_hops->elems;
7274                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7275                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7276                         LDKChannelDetails first_hops_conv_16_conv;
7277                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7278                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7279                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7280                         first_hops_conv_16_conv.is_owned = false;
7281                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7282                 }
7283                 FREE(first_hops);
7284                 first_hops_ptr = &first_hops_constr;
7285         }
7286         LDKInFlightHtlcs inflight_htlcs_conv;
7287         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7288         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7289         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7290         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7291         LDKThirtyTwoBytes _payment_hash_ref;
7292         CHECK(_payment_hash->arr_len == 32);
7293         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7294         LDKThirtyTwoBytes _payment_id_ref;
7295         CHECK(_payment_id->arr_len == 32);
7296         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7297         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7298         *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);
7299         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7300         return tag_ptr(ret_conv, true);
7301 }
7302
7303 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7304         return ThirtyTwoBytes_clone(&owner->a);
7305 }
7306 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
7307         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
7308         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7309         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
7310         return ret_arr;
7311 }
7312
7313 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7314         LDKChannelManager ret = owner->b;
7315         ret.is_owned = false;
7316         return ret;
7317 }
7318 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
7319         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
7320         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
7321         uint64_t ret_ref = 0;
7322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7324         return ret_ref;
7325 }
7326
7327 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7328 CHECK(owner->result_ok);
7329         return &*owner->contents.result;
7330 }
7331 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
7332         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7333         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7334         return ret_ret;
7335 }
7336
7337 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7338 CHECK(!owner->result_ok);
7339         return DecodeError_clone(&*owner->contents.err);
7340 }
7341 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
7342         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7343         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7344         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
7345         uint64_t ret_ref = tag_ptr(ret_copy, true);
7346         return ret_ref;
7347 }
7348
7349 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
7350         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7351         switch(obj->tag) {
7352                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
7353                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
7354                 default: abort();
7355         }
7356 }
7357 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
7358         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7359         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
7360                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
7361         return fixed_limit_msat_conv;
7362 }
7363 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
7364         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7365         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
7366                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
7367         return fee_rate_multiplier_conv;
7368 }
7369 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7370 CHECK(owner->result_ok);
7371         return MaxDustHTLCExposure_clone(&*owner->contents.result);
7372 }
7373 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
7374         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7375         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
7376         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
7377         uint64_t ret_ref = tag_ptr(ret_copy, true);
7378         return ret_ref;
7379 }
7380
7381 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7382 CHECK(!owner->result_ok);
7383         return DecodeError_clone(&*owner->contents.err);
7384 }
7385 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
7386         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7387         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7388         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
7389         uint64_t ret_ref = tag_ptr(ret_copy, true);
7390         return ret_ref;
7391 }
7392
7393 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7394         LDKChannelConfig ret = *owner->contents.result;
7395         ret.is_owned = false;
7396         return ret;
7397 }
7398 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
7399         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7400         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7401         uint64_t ret_ref = 0;
7402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7404         return ret_ref;
7405 }
7406
7407 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7408 CHECK(!owner->result_ok);
7409         return DecodeError_clone(&*owner->contents.err);
7410 }
7411 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
7412         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7413         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7414         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7415         uint64_t ret_ref = tag_ptr(ret_copy, true);
7416         return ret_ref;
7417 }
7418
7419 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
7420         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7421         switch(obj->tag) {
7422                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
7423                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
7424                 default: abort();
7425         }
7426 }
7427 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
7428         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7429         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
7430                         uint64_t some_ref = tag_ptr(&obj->some, false);
7431         return some_ref;
7432 }
7433 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
7434         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7435         switch(obj->tag) {
7436                 case LDKCOption_APIErrorZ_Some: return 0;
7437                 case LDKCOption_APIErrorZ_None: return 1;
7438                 default: abort();
7439         }
7440 }
7441 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
7442         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7443         assert(obj->tag == LDKCOption_APIErrorZ_Some);
7444                         uint64_t some_ref = tag_ptr(&obj->some, false);
7445         return some_ref;
7446 }
7447 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7448 CHECK(owner->result_ok);
7449         return COption_APIErrorZ_clone(&*owner->contents.result);
7450 }
7451 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
7452         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7453         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
7454         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
7455         uint64_t ret_ref = tag_ptr(ret_copy, true);
7456         return ret_ref;
7457 }
7458
7459 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7460 CHECK(!owner->result_ok);
7461         return DecodeError_clone(&*owner->contents.err);
7462 }
7463 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
7464         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7466         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
7467         uint64_t ret_ref = tag_ptr(ret_copy, true);
7468         return ret_ref;
7469 }
7470
7471 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
7472         LDKBigSize ret = *owner->contents.result;
7473         ret.is_owned = false;
7474         return ret;
7475 }
7476 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
7477         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
7478         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
7479         uint64_t ret_ref = 0;
7480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7482         return ret_ref;
7483 }
7484
7485 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
7486 CHECK(!owner->result_ok);
7487         return DecodeError_clone(&*owner->contents.err);
7488 }
7489 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
7490         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
7491         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7492         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
7493         uint64_t ret_ref = tag_ptr(ret_copy, true);
7494         return ret_ref;
7495 }
7496
7497 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
7498         LDKHostname ret = *owner->contents.result;
7499         ret.is_owned = false;
7500         return ret;
7501 }
7502 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
7503         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
7504         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
7505         uint64_t ret_ref = 0;
7506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7508         return ret_ref;
7509 }
7510
7511 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
7512 CHECK(!owner->result_ok);
7513         return DecodeError_clone(&*owner->contents.err);
7514 }
7515 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
7516         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
7517         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7518         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
7519         uint64_t ret_ref = tag_ptr(ret_copy, true);
7520         return ret_ref;
7521 }
7522
7523 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
7524         LDKTransactionU16LenLimited ret = *owner->contents.result;
7525         ret.is_owned = false;
7526         return ret;
7527 }
7528 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
7529         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
7530         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
7531         uint64_t ret_ref = 0;
7532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7534         return ret_ref;
7535 }
7536
7537 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
7538 CHECK(!owner->result_ok);
7539         return *owner->contents.err;
7540 }
7541 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
7542         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
7543         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
7544 }
7545
7546 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
7547         LDKTransactionU16LenLimited ret = *owner->contents.result;
7548         ret.is_owned = false;
7549         return ret;
7550 }
7551 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
7552         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
7553         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
7554         uint64_t ret_ref = 0;
7555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7557         return ret_ref;
7558 }
7559
7560 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
7561 CHECK(!owner->result_ok);
7562         return DecodeError_clone(&*owner->contents.err);
7563 }
7564 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
7565         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
7566         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7567         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
7568         uint64_t ret_ref = tag_ptr(ret_copy, true);
7569         return ret_ref;
7570 }
7571
7572 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
7573         LDKUntrustedString ret = *owner->contents.result;
7574         ret.is_owned = false;
7575         return ret;
7576 }
7577 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
7578         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
7579         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
7580         uint64_t ret_ref = 0;
7581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7583         return ret_ref;
7584 }
7585
7586 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
7587 CHECK(!owner->result_ok);
7588         return DecodeError_clone(&*owner->contents.err);
7589 }
7590 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
7591         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
7592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7593         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
7594         uint64_t ret_ref = tag_ptr(ret_copy, true);
7595         return ret_ref;
7596 }
7597
7598 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7599         LDKOutPoint ret = *owner->contents.result;
7600         ret.is_owned = false;
7601         return ret;
7602 }
7603 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
7604         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
7605         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
7606         uint64_t ret_ref = 0;
7607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7609         return ret_ref;
7610 }
7611
7612 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7613 CHECK(!owner->result_ok);
7614         return DecodeError_clone(&*owner->contents.err);
7615 }
7616 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
7617         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
7618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7619         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
7620         uint64_t ret_ref = tag_ptr(ret_copy, true);
7621         return ret_ref;
7622 }
7623
7624 typedef struct LDKType_JCalls {
7625         atomic_size_t refcnt;
7626         uint32_t instance_ptr;
7627 } LDKType_JCalls;
7628 static void LDKType_JCalls_free(void* this_arg) {
7629         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7630         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7631                 FREE(j_calls);
7632         }
7633 }
7634 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7635         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7636         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
7637 }
7638 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7639         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7640         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0);
7641         LDKStr ret_conv = str_ref_to_owned_c(ret);
7642         return ret_conv;
7643 }
7644 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7645         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7646         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
7647         LDKCVec_u8Z ret_ref;
7648         ret_ref.datalen = ret->arr_len;
7649         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7650         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7651         return ret_ref;
7652 }
7653 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7654         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7655         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7656 }
7657 static inline LDKType LDKType_init (JSValue o) {
7658         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7659         atomic_init(&calls->refcnt, 1);
7660         calls->instance_ptr = o;
7661
7662         LDKType ret = {
7663                 .this_arg = (void*) calls,
7664                 .type_id = type_id_LDKType_jcall,
7665                 .debug_str = debug_str_LDKType_jcall,
7666                 .write = write_LDKType_jcall,
7667                 .cloned = LDKType_JCalls_cloned,
7668                 .free = LDKType_JCalls_free,
7669         };
7670         return ret;
7671 }
7672 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
7673         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7674         *res_ptr = LDKType_init(o);
7675         return tag_ptr(res_ptr, true);
7676 }
7677 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
7678         void* this_arg_ptr = untag_ptr(this_arg);
7679         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7680         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7681         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7682         return ret_conv;
7683 }
7684
7685 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
7686         void* this_arg_ptr = untag_ptr(this_arg);
7687         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7688         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7689         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7690         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7691         Str_free(ret_str);
7692         return ret_conv;
7693 }
7694
7695 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
7696         void* this_arg_ptr = untag_ptr(this_arg);
7697         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7698         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7699         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7702         CVec_u8Z_free(ret_var);
7703         return ret_arr;
7704 }
7705
7706 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
7707         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7708         switch(obj->tag) {
7709                 case LDKCOption_TypeZ_Some: return 0;
7710                 case LDKCOption_TypeZ_None: return 1;
7711                 default: abort();
7712         }
7713 }
7714 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
7715         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7716         assert(obj->tag == LDKCOption_TypeZ_Some);
7717                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7718                         *some_ret = Type_clone(&obj->some);
7719         return tag_ptr(some_ret, true);
7720 }
7721 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7722 CHECK(owner->result_ok);
7723         return COption_TypeZ_clone(&*owner->contents.result);
7724 }
7725 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
7726         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7727         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7728         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7729         uint64_t ret_ref = tag_ptr(ret_copy, true);
7730         return ret_ref;
7731 }
7732
7733 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7734 CHECK(!owner->result_ok);
7735         return DecodeError_clone(&*owner->contents.err);
7736 }
7737 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
7738         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7739         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7740         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7741         uint64_t ret_ref = tag_ptr(ret_copy, true);
7742         return ret_ref;
7743 }
7744
7745 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
7746         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7747         switch(obj->tag) {
7748                 case LDKPaymentError_Invoice: return 0;
7749                 case LDKPaymentError_Sending: return 1;
7750                 default: abort();
7751         }
7752 }
7753 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
7754         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7755         assert(obj->tag == LDKPaymentError_Invoice);
7756                         LDKStr invoice_str = obj->invoice;
7757                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
7758         return invoice_conv;
7759 }
7760 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
7761         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7762         assert(obj->tag == LDKPaymentError_Sending);
7763                         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
7764         return sending_conv;
7765 }
7766 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7767 CHECK(owner->result_ok);
7768         return ThirtyTwoBytes_clone(&*owner->contents.result);
7769 }
7770 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
7771         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7772         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7773         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
7774         return ret_arr;
7775 }
7776
7777 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7778 CHECK(!owner->result_ok);
7779         return PaymentError_clone(&*owner->contents.err);
7780 }
7781 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
7782         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7783         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7784         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7785         uint64_t ret_ref = tag_ptr(ret_copy, true);
7786         return ret_ref;
7787 }
7788
7789 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
7790 CHECK(owner->result_ok);
7791         return *owner->contents.result;
7792 }
7793 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
7794         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
7795         CResult_NonePaymentErrorZ_get_ok(owner_conv);
7796 }
7797
7798 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
7799 CHECK(!owner->result_ok);
7800         return PaymentError_clone(&*owner->contents.err);
7801 }
7802 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
7803         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
7804         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7805         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
7806         uint64_t ret_ref = tag_ptr(ret_copy, true);
7807         return ret_ref;
7808 }
7809
7810 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7811 CHECK(owner->result_ok);
7812         return *owner->contents.result;
7813 }
7814 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
7815         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7816         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7817         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7818         return ret_conv;
7819 }
7820
7821 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7822 CHECK(!owner->result_ok);
7823         return *owner->contents.err;
7824 }
7825 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
7826         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7827         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
7828         return ret_conv;
7829 }
7830
7831 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7832         LDKChannelMonitorUpdate ret = *owner->contents.result;
7833         ret.is_owned = false;
7834         return ret;
7835 }
7836 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7837         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7838         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(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 struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7846 CHECK(!owner->result_ok);
7847         return DecodeError_clone(&*owner->contents.err);
7848 }
7849 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
7850         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7851         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7852         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7853         uint64_t ret_ref = tag_ptr(ret_copy, true);
7854         return ret_ref;
7855 }
7856
7857 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
7858         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7859         switch(obj->tag) {
7860                 case LDKCOption_MonitorEventZ_Some: return 0;
7861                 case LDKCOption_MonitorEventZ_None: return 1;
7862                 default: abort();
7863         }
7864 }
7865 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
7866         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7867         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
7868                         uint64_t some_ref = tag_ptr(&obj->some, false);
7869         return some_ref;
7870 }
7871 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7872 CHECK(owner->result_ok);
7873         return COption_MonitorEventZ_clone(&*owner->contents.result);
7874 }
7875 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
7876         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7877         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7878         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7879         uint64_t ret_ref = tag_ptr(ret_copy, true);
7880         return ret_ref;
7881 }
7882
7883 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7884 CHECK(!owner->result_ok);
7885         return DecodeError_clone(&*owner->contents.err);
7886 }
7887 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
7888         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7889         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7890         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7891         uint64_t ret_ref = tag_ptr(ret_copy, true);
7892         return ret_ref;
7893 }
7894
7895 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7896         LDKHTLCUpdate ret = *owner->contents.result;
7897         ret.is_owned = false;
7898         return ret;
7899 }
7900 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7901         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7902         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7903         uint64_t ret_ref = 0;
7904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7906         return ret_ref;
7907 }
7908
7909 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7910 CHECK(!owner->result_ok);
7911         return DecodeError_clone(&*owner->contents.err);
7912 }
7913 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
7914         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7915         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7916         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7917         uint64_t ret_ref = tag_ptr(ret_copy, true);
7918         return ret_ref;
7919 }
7920
7921 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7922         LDKOutPoint ret = owner->a;
7923         ret.is_owned = false;
7924         return ret;
7925 }
7926 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
7927         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7928         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7929         uint64_t ret_ref = 0;
7930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7932         return ret_ref;
7933 }
7934
7935 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7936         return CVec_u8Z_clone(&owner->b);
7937 }
7938 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
7939         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7940         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7941         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7942         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7943         CVec_u8Z_free(ret_var);
7944         return ret_arr;
7945 }
7946
7947 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7948         return owner->a;
7949 }
7950 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
7951         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7952         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
7953         return ret_conv;
7954 }
7955
7956 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7957         return CVec_u8Z_clone(&owner->b);
7958 }
7959 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
7960         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7961         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7962         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7963         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7964         CVec_u8Z_free(ret_var);
7965         return ret_arr;
7966 }
7967
7968 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7969         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7970         for (size_t i = 0; i < ret.datalen; i++) {
7971                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7972         }
7973         return ret;
7974 }
7975 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7976         return ThirtyTwoBytes_clone(&owner->a);
7977 }
7978 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
7979         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7980         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7981         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
7982         return ret_arr;
7983 }
7984
7985 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7986         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7987 }
7988 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
7989         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7990         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7991         uint64_tArray ret_arr = NULL;
7992         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7993         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7994         for (size_t v = 0; v < ret_var.datalen; v++) {
7995                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7996                 *ret_conv_21_conv = ret_var.data[v];
7997                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
7998         }
7999         
8000         FREE(ret_var.data);
8001         return ret_arr;
8002 }
8003
8004 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8005         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
8006         for (size_t i = 0; i < ret.datalen; i++) {
8007                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8008         }
8009         return ret;
8010 }
8011 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8012         return owner->a;
8013 }
8014 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
8015         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8016         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8017         return ret_conv;
8018 }
8019
8020 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8021         return TxOut_clone(&owner->b);
8022 }
8023 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
8024         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8025         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8026         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8027         return tag_ptr(ret_ref, true);
8028 }
8029
8030 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8031         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8032         for (size_t i = 0; i < ret.datalen; i++) {
8033                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8034         }
8035         return ret;
8036 }
8037 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8038         return ThirtyTwoBytes_clone(&owner->a);
8039 }
8040 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
8041         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8042         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8043         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
8044         return ret_arr;
8045 }
8046
8047 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8048         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8049 }
8050 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
8051         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8052         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8053         uint64_tArray ret_arr = NULL;
8054         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8055         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8056         for (size_t u = 0; u < ret_var.datalen; u++) {
8057                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8058                 *ret_conv_20_conv = ret_var.data[u];
8059                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
8060         }
8061         
8062         FREE(ret_var.data);
8063         return ret_arr;
8064 }
8065
8066 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8067         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
8068         for (size_t i = 0; i < ret.datalen; i++) {
8069                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8070         }
8071         return ret;
8072 }
8073 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
8074         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8075         switch(obj->tag) {
8076                 case LDKBalance_ClaimableOnChannelClose: return 0;
8077                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
8078                 case LDKBalance_ContentiousClaimable: return 2;
8079                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
8080                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
8081                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
8082                 default: abort();
8083         }
8084 }
8085 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
8086         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8087         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
8088                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
8089         return amount_satoshis_conv;
8090 }
8091 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
8092         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8093         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
8094                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
8095         return amount_satoshis_conv;
8096 }
8097 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
8098         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8099         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
8100                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8101         return confirmation_height_conv;
8102 }
8103 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
8104         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8105         assert(obj->tag == LDKBalance_ContentiousClaimable);
8106                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
8107         return amount_satoshis_conv;
8108 }
8109 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
8110         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8111         assert(obj->tag == LDKBalance_ContentiousClaimable);
8112                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8113         return timeout_height_conv;
8114 }
8115 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
8116         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8117         assert(obj->tag == LDKBalance_ContentiousClaimable);
8118                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8119                         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
8120         return payment_hash_arr;
8121 }
8122 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
8123         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8124         assert(obj->tag == LDKBalance_ContentiousClaimable);
8125                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
8126                         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
8127         return payment_preimage_arr;
8128 }
8129 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
8130         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8131         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8132                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
8133         return amount_satoshis_conv;
8134 }
8135 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
8136         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8137         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8138                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
8139         return claimable_height_conv;
8140 }
8141 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
8142         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8143         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8144                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8145                         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
8146         return payment_hash_arr;
8147 }
8148 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
8149         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8150         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8151                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
8152         return amount_satoshis_conv;
8153 }
8154 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
8155         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8156         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8157                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
8158         return expiry_height_conv;
8159 }
8160 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
8161         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8162         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8163                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8164                         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
8165         return payment_hash_arr;
8166 }
8167 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
8168         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8169         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
8170                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
8171         return amount_satoshis_conv;
8172 }
8173 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8174         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8175         for (size_t i = 0; i < ret.datalen; i++) {
8176                 ret.data[i] = Balance_clone(&orig->data[i]);
8177         }
8178         return ret;
8179 }
8180 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
8181         return ThirtyTwoBytes_clone(&owner->a);
8182 }
8183 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
8184         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
8185         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8186         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
8187         return ret_arr;
8188 }
8189
8190 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
8191         LDKChannelMonitor ret = owner->b;
8192         ret.is_owned = false;
8193         return ret;
8194 }
8195 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
8196         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
8197         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
8198         uint64_t ret_ref = 0;
8199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8201         return ret_ref;
8202 }
8203
8204 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8205 CHECK(owner->result_ok);
8206         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8207 }
8208 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
8209         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8210         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8211         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8212         return tag_ptr(ret_conv, true);
8213 }
8214
8215 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8216 CHECK(!owner->result_ok);
8217         return DecodeError_clone(&*owner->contents.err);
8218 }
8219 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
8220         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8221         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8222         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8223         uint64_t ret_ref = tag_ptr(ret_copy, true);
8224         return ret_ref;
8225 }
8226
8227 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8228         return owner->a;
8229 }
8230 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
8231         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8232         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8233         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
8234         return ret_arr;
8235 }
8236
8237 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8238         return Type_clone(&owner->b);
8239 }
8240 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
8241         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8242         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8243         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8244         return tag_ptr(ret_ret, true);
8245 }
8246
8247 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8248         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8249         for (size_t i = 0; i < ret.datalen; i++) {
8250                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8251         }
8252         return ret;
8253 }
8254 typedef struct LDKCustomOnionMessageContents_JCalls {
8255         atomic_size_t refcnt;
8256         uint32_t instance_ptr;
8257 } LDKCustomOnionMessageContents_JCalls;
8258 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
8259         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
8260         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8261                 FREE(j_calls);
8262         }
8263 }
8264 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
8265         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
8266         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
8267 }
8268 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
8269         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
8270         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0);
8271         LDKCVec_u8Z ret_ref;
8272         ret_ref.datalen = ret->arr_len;
8273         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8274         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8275         return ret_ref;
8276 }
8277 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
8278         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
8279         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8280 }
8281 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
8282         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
8283         atomic_init(&calls->refcnt, 1);
8284         calls->instance_ptr = o;
8285
8286         LDKCustomOnionMessageContents ret = {
8287                 .this_arg = (void*) calls,
8288                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
8289                 .write = write_LDKCustomOnionMessageContents_jcall,
8290                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
8291                 .free = LDKCustomOnionMessageContents_JCalls_free,
8292         };
8293         return ret;
8294 }
8295 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
8296         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
8297         *res_ptr = LDKCustomOnionMessageContents_init(o);
8298         return tag_ptr(res_ptr, true);
8299 }
8300 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
8301         void* this_arg_ptr = untag_ptr(this_arg);
8302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8303         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
8304         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8305         return ret_conv;
8306 }
8307
8308 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
8309         void* this_arg_ptr = untag_ptr(this_arg);
8310         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8311         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
8312         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8313         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8314         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8315         CVec_u8Z_free(ret_var);
8316         return ret_arr;
8317 }
8318
8319 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
8320         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
8321         switch(obj->tag) {
8322                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
8323                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
8324                 default: abort();
8325         }
8326 }
8327 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
8328         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
8329         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
8330                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
8331                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
8332         return tag_ptr(some_ret, true);
8333 }
8334 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8335 CHECK(owner->result_ok);
8336         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
8337 }
8338 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
8339         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8340         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
8341         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8342         uint64_t ret_ref = tag_ptr(ret_copy, true);
8343         return ret_ref;
8344 }
8345
8346 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8347 CHECK(!owner->result_ok);
8348         return DecodeError_clone(&*owner->contents.err);
8349 }
8350 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
8351         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8352         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8353         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8354         uint64_t ret_ref = tag_ptr(ret_copy, true);
8355         return ret_ref;
8356 }
8357
8358 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
8359         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
8360         switch(obj->tag) {
8361                 case LDKCOption_NetAddressZ_Some: return 0;
8362                 case LDKCOption_NetAddressZ_None: return 1;
8363                 default: abort();
8364         }
8365 }
8366 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
8367         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
8368         assert(obj->tag == LDKCOption_NetAddressZ_Some);
8369                         uint64_t some_ref = tag_ptr(&obj->some, false);
8370         return some_ref;
8371 }
8372 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
8373         return owner->a;
8374 }
8375 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(uint64_t owner) {
8376         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
8377         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8378         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form, 33);
8379         return ret_arr;
8380 }
8381
8382 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
8383         return COption_NetAddressZ_clone(&owner->b);
8384 }
8385 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(uint64_t owner) {
8386         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
8387         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
8388         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
8389         uint64_t ret_ref = tag_ptr(ret_copy, true);
8390         return ret_ref;
8391 }
8392
8393 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
8394         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
8395         for (size_t i = 0; i < ret.datalen; i++) {
8396                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
8397         }
8398         return ret;
8399 }
8400 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8401 CHECK(owner->result_ok);
8402         return CVec_u8Z_clone(&*owner->contents.result);
8403 }
8404 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
8405         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8406         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8407         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8408         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8409         CVec_u8Z_free(ret_var);
8410         return ret_arr;
8411 }
8412
8413 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8414         LDKPeerHandleError ret = *owner->contents.err;
8415         ret.is_owned = false;
8416         return ret;
8417 }
8418 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
8419         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8420         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8421         uint64_t ret_ref = 0;
8422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8424         return ret_ref;
8425 }
8426
8427 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8428 CHECK(owner->result_ok);
8429         return *owner->contents.result;
8430 }
8431 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
8432         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8433         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8434 }
8435
8436 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8437         LDKPeerHandleError ret = *owner->contents.err;
8438         ret.is_owned = false;
8439         return ret;
8440 }
8441 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
8442         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8443         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(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 bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8451 CHECK(owner->result_ok);
8452         return *owner->contents.result;
8453 }
8454 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
8455         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8456         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8457         return ret_conv;
8458 }
8459
8460 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8461         LDKPeerHandleError ret = *owner->contents.err;
8462         ret.is_owned = false;
8463         return ret;
8464 }
8465 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
8466         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8467         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8468         uint64_t ret_ref = 0;
8469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8471         return ret_ref;
8472 }
8473
8474 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
8475         LDKOnionMessagePath ret = *owner->contents.result;
8476         ret.is_owned = false;
8477         return ret;
8478 }
8479 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
8480         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
8481         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
8482         uint64_t ret_ref = 0;
8483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8485         return ret_ref;
8486 }
8487
8488 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
8489 CHECK(!owner->result_ok);
8490         return *owner->contents.err;
8491 }
8492 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
8493         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
8494         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
8495 }
8496
8497 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
8498         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
8499         switch(obj->tag) {
8500                 case LDKSendError_Secp256k1: return 0;
8501                 case LDKSendError_TooBigPacket: return 1;
8502                 case LDKSendError_TooFewBlindedHops: return 2;
8503                 case LDKSendError_InvalidFirstHop: return 3;
8504                 case LDKSendError_InvalidMessage: return 4;
8505                 case LDKSendError_BufferFull: return 5;
8506                 case LDKSendError_GetNodeIdFailed: return 6;
8507                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
8508                 default: abort();
8509         }
8510 }
8511 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
8512         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
8513         assert(obj->tag == LDKSendError_Secp256k1);
8514                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
8515         return secp256k1_conv;
8516 }
8517 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
8518 CHECK(owner->result_ok);
8519         return *owner->contents.result;
8520 }
8521 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
8522         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
8523         CResult_NoneSendErrorZ_get_ok(owner_conv);
8524 }
8525
8526 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
8527 CHECK(!owner->result_ok);
8528         return SendError_clone(&*owner->contents.err);
8529 }
8530 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
8531         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
8532         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
8533         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
8534         uint64_t ret_ref = tag_ptr(ret_copy, true);
8535         return ret_ref;
8536 }
8537
8538 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
8539         LDKBlindedPath ret = *owner->contents.result;
8540         ret.is_owned = false;
8541         return ret;
8542 }
8543 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
8544         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
8545         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
8546         uint64_t ret_ref = 0;
8547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8549         return ret_ref;
8550 }
8551
8552 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
8553 CHECK(!owner->result_ok);
8554         return *owner->contents.err;
8555 }
8556 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
8557         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
8558         CResult_BlindedPathNoneZ_get_err(owner_conv);
8559 }
8560
8561 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
8562         LDKBlindedPath ret = *owner->contents.result;
8563         ret.is_owned = false;
8564         return ret;
8565 }
8566 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
8567         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
8568         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
8569         uint64_t ret_ref = 0;
8570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8572         return ret_ref;
8573 }
8574
8575 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
8576 CHECK(!owner->result_ok);
8577         return DecodeError_clone(&*owner->contents.err);
8578 }
8579 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
8580         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
8581         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8582         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
8583         uint64_t ret_ref = tag_ptr(ret_copy, true);
8584         return ret_ref;
8585 }
8586
8587 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
8588         LDKBlindedHop ret = *owner->contents.result;
8589         ret.is_owned = false;
8590         return ret;
8591 }
8592 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
8593         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
8594         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
8595         uint64_t ret_ref = 0;
8596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8598         return ret_ref;
8599 }
8600
8601 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
8602 CHECK(!owner->result_ok);
8603         return DecodeError_clone(&*owner->contents.err);
8604 }
8605 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
8606         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
8607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8608         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
8609         uint64_t ret_ref = tag_ptr(ret_copy, true);
8610         return ret_ref;
8611 }
8612
8613 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
8614         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8615         switch(obj->tag) {
8616                 case LDKGraphSyncError_DecodeError: return 0;
8617                 case LDKGraphSyncError_LightningError: return 1;
8618                 default: abort();
8619         }
8620 }
8621 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
8622         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8623         assert(obj->tag == LDKGraphSyncError_DecodeError);
8624                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
8625         return decode_error_ref;
8626 }
8627 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
8628         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8629         assert(obj->tag == LDKGraphSyncError_LightningError);
8630                         LDKLightningError lightning_error_var = obj->lightning_error;
8631                         uint64_t lightning_error_ref = 0;
8632                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8633                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8634         return lightning_error_ref;
8635 }
8636 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8637 CHECK(owner->result_ok);
8638         return *owner->contents.result;
8639 }
8640 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
8641         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8642         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8643         return ret_conv;
8644 }
8645
8646 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8647 CHECK(!owner->result_ok);
8648         return GraphSyncError_clone(&*owner->contents.err);
8649 }
8650 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
8651         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8652         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8653         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8654         uint64_t ret_ref = tag_ptr(ret_copy, true);
8655         return ret_ref;
8656 }
8657
8658 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
8659 CHECK(owner->result_ok);
8660         return *owner->contents.result;
8661 }
8662 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
8663         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
8664         CResult_NoneErrorZ_get_ok(owner_conv);
8665 }
8666
8667 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
8668 CHECK(!owner->result_ok);
8669         return *owner->contents.err;
8670 }
8671 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
8672         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
8673         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
8674         return ret_conv;
8675 }
8676
8677 uint32_t __attribute__((export_name("TS_LDKCOption_ScriptZ_ty_from_ptr"))) TS_LDKCOption_ScriptZ_ty_from_ptr(uint64_t ptr) {
8678         LDKCOption_ScriptZ *obj = (LDKCOption_ScriptZ*)untag_ptr(ptr);
8679         switch(obj->tag) {
8680                 case LDKCOption_ScriptZ_Some: return 0;
8681                 case LDKCOption_ScriptZ_None: return 1;
8682                 default: abort();
8683         }
8684 }
8685 int8_tArray __attribute__((export_name("TS_LDKCOption_ScriptZ_Some_get_some"))) TS_LDKCOption_ScriptZ_Some_get_some(uint64_t ptr) {
8686         LDKCOption_ScriptZ *obj = (LDKCOption_ScriptZ*)untag_ptr(ptr);
8687         assert(obj->tag == LDKCOption_ScriptZ_Some);
8688                         LDKCVec_u8Z some_var = obj->some;
8689                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
8690                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
8691         return some_arr;
8692 }
8693 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8694         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8695         for (size_t i = 0; i < ret.datalen; i++) {
8696                 ret.data[i] = Witness_clone(&orig->data[i]);
8697         }
8698         return ret;
8699 }
8700 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
8701         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8702         switch(obj->tag) {
8703                 case LDKCOption_i64Z_Some: return 0;
8704                 case LDKCOption_i64Z_None: return 1;
8705                 default: abort();
8706         }
8707 }
8708 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
8709         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8710         assert(obj->tag == LDKCOption_i64Z_Some);
8711                         int64_t some_conv = obj->some;
8712         return some_conv;
8713 }
8714 uint32_t __attribute__((export_name("TS_LDKCOption_TxidZ_ty_from_ptr"))) TS_LDKCOption_TxidZ_ty_from_ptr(uint64_t ptr) {
8715         LDKCOption_TxidZ *obj = (LDKCOption_TxidZ*)untag_ptr(ptr);
8716         switch(obj->tag) {
8717                 case LDKCOption_TxidZ_Some: return 0;
8718                 case LDKCOption_TxidZ_None: return 1;
8719                 default: abort();
8720         }
8721 }
8722 int8_tArray __attribute__((export_name("TS_LDKCOption_TxidZ_Some_get_some"))) TS_LDKCOption_TxidZ_Some_get_some(uint64_t ptr) {
8723         LDKCOption_TxidZ *obj = (LDKCOption_TxidZ*)untag_ptr(ptr);
8724         assert(obj->tag == LDKCOption_TxidZ_Some);
8725                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8726                         memcpy(some_arr->elems, obj->some.data, 32);
8727         return some_arr;
8728 }
8729 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8730 CHECK(owner->result_ok);
8731         return NetAddress_clone(&*owner->contents.result);
8732 }
8733 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
8734         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8735         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8736         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8737         uint64_t ret_ref = tag_ptr(ret_copy, true);
8738         return ret_ref;
8739 }
8740
8741 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8742 CHECK(!owner->result_ok);
8743         return DecodeError_clone(&*owner->contents.err);
8744 }
8745 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
8746         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8747         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8748         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8749         uint64_t ret_ref = tag_ptr(ret_copy, true);
8750         return ret_ref;
8751 }
8752
8753 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8754         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8755         for (size_t i = 0; i < ret.datalen; i++) {
8756                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8757         }
8758         return ret;
8759 }
8760 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8761         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8762         for (size_t i = 0; i < ret.datalen; i++) {
8763                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8764         }
8765         return ret;
8766 }
8767 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8768         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8769         for (size_t i = 0; i < ret.datalen; i++) {
8770                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8771         }
8772         return ret;
8773 }
8774 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8775         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8776         for (size_t i = 0; i < ret.datalen; i++) {
8777                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8778         }
8779         return ret;
8780 }
8781 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8782         LDKAcceptChannel ret = *owner->contents.result;
8783         ret.is_owned = false;
8784         return ret;
8785 }
8786 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
8787         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8788         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8789         uint64_t ret_ref = 0;
8790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8792         return ret_ref;
8793 }
8794
8795 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8796 CHECK(!owner->result_ok);
8797         return DecodeError_clone(&*owner->contents.err);
8798 }
8799 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
8800         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8801         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8802         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8803         uint64_t ret_ref = tag_ptr(ret_copy, true);
8804         return ret_ref;
8805 }
8806
8807 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8808         LDKAcceptChannelV2 ret = *owner->contents.result;
8809         ret.is_owned = false;
8810         return ret;
8811 }
8812 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8813         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8814         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8815         uint64_t ret_ref = 0;
8816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8818         return ret_ref;
8819 }
8820
8821 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8822 CHECK(!owner->result_ok);
8823         return DecodeError_clone(&*owner->contents.err);
8824 }
8825 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8826         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8827         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8828         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8829         uint64_t ret_ref = tag_ptr(ret_copy, true);
8830         return ret_ref;
8831 }
8832
8833 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8834         LDKTxAddInput ret = *owner->contents.result;
8835         ret.is_owned = false;
8836         return ret;
8837 }
8838 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
8839         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8840         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
8841         uint64_t ret_ref = 0;
8842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8844         return ret_ref;
8845 }
8846
8847 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8848 CHECK(!owner->result_ok);
8849         return DecodeError_clone(&*owner->contents.err);
8850 }
8851 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
8852         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8853         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8854         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
8855         uint64_t ret_ref = tag_ptr(ret_copy, true);
8856         return ret_ref;
8857 }
8858
8859 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8860         LDKTxAddOutput ret = *owner->contents.result;
8861         ret.is_owned = false;
8862         return ret;
8863 }
8864 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
8865         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8866         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
8867         uint64_t ret_ref = 0;
8868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8870         return ret_ref;
8871 }
8872
8873 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8874 CHECK(!owner->result_ok);
8875         return DecodeError_clone(&*owner->contents.err);
8876 }
8877 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
8878         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8879         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8880         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
8881         uint64_t ret_ref = tag_ptr(ret_copy, true);
8882         return ret_ref;
8883 }
8884
8885 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8886         LDKTxRemoveInput ret = *owner->contents.result;
8887         ret.is_owned = false;
8888         return ret;
8889 }
8890 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
8891         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8892         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
8893         uint64_t ret_ref = 0;
8894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8896         return ret_ref;
8897 }
8898
8899 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8900 CHECK(!owner->result_ok);
8901         return DecodeError_clone(&*owner->contents.err);
8902 }
8903 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
8904         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8905         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8906         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
8907         uint64_t ret_ref = tag_ptr(ret_copy, true);
8908         return ret_ref;
8909 }
8910
8911 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8912         LDKTxRemoveOutput ret = *owner->contents.result;
8913         ret.is_owned = false;
8914         return ret;
8915 }
8916 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
8917         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
8918         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
8919         uint64_t ret_ref = 0;
8920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8922         return ret_ref;
8923 }
8924
8925 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8926 CHECK(!owner->result_ok);
8927         return DecodeError_clone(&*owner->contents.err);
8928 }
8929 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
8930         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
8931         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8932         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
8933         uint64_t ret_ref = tag_ptr(ret_copy, true);
8934         return ret_ref;
8935 }
8936
8937 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
8938         LDKTxComplete ret = *owner->contents.result;
8939         ret.is_owned = false;
8940         return ret;
8941 }
8942 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
8943         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
8944         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
8945         uint64_t ret_ref = 0;
8946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8948         return ret_ref;
8949 }
8950
8951 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
8952 CHECK(!owner->result_ok);
8953         return DecodeError_clone(&*owner->contents.err);
8954 }
8955 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
8956         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
8957         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8958         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
8959         uint64_t ret_ref = tag_ptr(ret_copy, true);
8960         return ret_ref;
8961 }
8962
8963 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
8964         LDKTxSignatures ret = *owner->contents.result;
8965         ret.is_owned = false;
8966         return ret;
8967 }
8968 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
8969         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
8970         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
8971         uint64_t ret_ref = 0;
8972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8974         return ret_ref;
8975 }
8976
8977 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
8978 CHECK(!owner->result_ok);
8979         return DecodeError_clone(&*owner->contents.err);
8980 }
8981 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
8982         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
8983         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8984         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
8985         uint64_t ret_ref = tag_ptr(ret_copy, true);
8986         return ret_ref;
8987 }
8988
8989 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
8990         LDKTxInitRbf ret = *owner->contents.result;
8991         ret.is_owned = false;
8992         return ret;
8993 }
8994 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
8995         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
8996         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
8997         uint64_t ret_ref = 0;
8998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9000         return ret_ref;
9001 }
9002
9003 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9004 CHECK(!owner->result_ok);
9005         return DecodeError_clone(&*owner->contents.err);
9006 }
9007 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
9008         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9009         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9010         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9011         uint64_t ret_ref = tag_ptr(ret_copy, true);
9012         return ret_ref;
9013 }
9014
9015 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9016         LDKTxAckRbf ret = *owner->contents.result;
9017         ret.is_owned = false;
9018         return ret;
9019 }
9020 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
9021         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9022         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9023         uint64_t ret_ref = 0;
9024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9026         return ret_ref;
9027 }
9028
9029 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9030 CHECK(!owner->result_ok);
9031         return DecodeError_clone(&*owner->contents.err);
9032 }
9033 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
9034         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9035         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9036         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9037         uint64_t ret_ref = tag_ptr(ret_copy, true);
9038         return ret_ref;
9039 }
9040
9041 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9042         LDKTxAbort ret = *owner->contents.result;
9043         ret.is_owned = false;
9044         return ret;
9045 }
9046 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
9047         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9048         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9049         uint64_t ret_ref = 0;
9050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9052         return ret_ref;
9053 }
9054
9055 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9056 CHECK(!owner->result_ok);
9057         return DecodeError_clone(&*owner->contents.err);
9058 }
9059 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
9060         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9061         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9062         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9063         uint64_t ret_ref = tag_ptr(ret_copy, true);
9064         return ret_ref;
9065 }
9066
9067 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9068         LDKAnnouncementSignatures ret = *owner->contents.result;
9069         ret.is_owned = false;
9070         return ret;
9071 }
9072 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
9073         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9074         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9075         uint64_t ret_ref = 0;
9076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9078         return ret_ref;
9079 }
9080
9081 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9082 CHECK(!owner->result_ok);
9083         return DecodeError_clone(&*owner->contents.err);
9084 }
9085 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
9086         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9087         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9088         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9089         uint64_t ret_ref = tag_ptr(ret_copy, true);
9090         return ret_ref;
9091 }
9092
9093 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9094         LDKChannelReestablish ret = *owner->contents.result;
9095         ret.is_owned = false;
9096         return ret;
9097 }
9098 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
9099         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9100         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9101         uint64_t ret_ref = 0;
9102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9104         return ret_ref;
9105 }
9106
9107 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9108 CHECK(!owner->result_ok);
9109         return DecodeError_clone(&*owner->contents.err);
9110 }
9111 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
9112         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9113         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9114         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9115         uint64_t ret_ref = tag_ptr(ret_copy, true);
9116         return ret_ref;
9117 }
9118
9119 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9120         LDKClosingSigned ret = *owner->contents.result;
9121         ret.is_owned = false;
9122         return ret;
9123 }
9124 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9125         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9126         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9127         uint64_t ret_ref = 0;
9128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9130         return ret_ref;
9131 }
9132
9133 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9134 CHECK(!owner->result_ok);
9135         return DecodeError_clone(&*owner->contents.err);
9136 }
9137 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
9138         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9139         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9140         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9141         uint64_t ret_ref = tag_ptr(ret_copy, true);
9142         return ret_ref;
9143 }
9144
9145 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9146         LDKClosingSignedFeeRange ret = *owner->contents.result;
9147         ret.is_owned = false;
9148         return ret;
9149 }
9150 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
9151         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9152         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9153         uint64_t ret_ref = 0;
9154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9156         return ret_ref;
9157 }
9158
9159 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9160 CHECK(!owner->result_ok);
9161         return DecodeError_clone(&*owner->contents.err);
9162 }
9163 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
9164         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9165         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9166         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9167         uint64_t ret_ref = tag_ptr(ret_copy, true);
9168         return ret_ref;
9169 }
9170
9171 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9172         LDKCommitmentSigned ret = *owner->contents.result;
9173         ret.is_owned = false;
9174         return ret;
9175 }
9176 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
9177         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9178         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9179         uint64_t ret_ref = 0;
9180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9182         return ret_ref;
9183 }
9184
9185 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9186 CHECK(!owner->result_ok);
9187         return DecodeError_clone(&*owner->contents.err);
9188 }
9189 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
9190         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9191         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9192         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9193         uint64_t ret_ref = tag_ptr(ret_copy, true);
9194         return ret_ref;
9195 }
9196
9197 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9198         LDKFundingCreated ret = *owner->contents.result;
9199         ret.is_owned = false;
9200         return ret;
9201 }
9202 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
9203         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9204         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9205         uint64_t ret_ref = 0;
9206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9208         return ret_ref;
9209 }
9210
9211 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9212 CHECK(!owner->result_ok);
9213         return DecodeError_clone(&*owner->contents.err);
9214 }
9215 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
9216         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9217         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9218         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9219         uint64_t ret_ref = tag_ptr(ret_copy, true);
9220         return ret_ref;
9221 }
9222
9223 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9224         LDKFundingSigned ret = *owner->contents.result;
9225         ret.is_owned = false;
9226         return ret;
9227 }
9228 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9229         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9230         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9231         uint64_t ret_ref = 0;
9232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9234         return ret_ref;
9235 }
9236
9237 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9238 CHECK(!owner->result_ok);
9239         return DecodeError_clone(&*owner->contents.err);
9240 }
9241 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
9242         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9243         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9244         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9245         uint64_t ret_ref = tag_ptr(ret_copy, true);
9246         return ret_ref;
9247 }
9248
9249 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9250         LDKChannelReady ret = *owner->contents.result;
9251         ret.is_owned = false;
9252         return ret;
9253 }
9254 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
9255         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9256         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9257         uint64_t ret_ref = 0;
9258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9260         return ret_ref;
9261 }
9262
9263 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9264 CHECK(!owner->result_ok);
9265         return DecodeError_clone(&*owner->contents.err);
9266 }
9267 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
9268         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9269         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9270         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9271         uint64_t ret_ref = tag_ptr(ret_copy, true);
9272         return ret_ref;
9273 }
9274
9275 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9276         LDKInit ret = *owner->contents.result;
9277         ret.is_owned = false;
9278         return ret;
9279 }
9280 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
9281         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9282         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9283         uint64_t ret_ref = 0;
9284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9286         return ret_ref;
9287 }
9288
9289 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9290 CHECK(!owner->result_ok);
9291         return DecodeError_clone(&*owner->contents.err);
9292 }
9293 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
9294         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9295         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9296         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
9297         uint64_t ret_ref = tag_ptr(ret_copy, true);
9298         return ret_ref;
9299 }
9300
9301 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9302         LDKOpenChannel ret = *owner->contents.result;
9303         ret.is_owned = false;
9304         return ret;
9305 }
9306 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
9307         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9308         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9309         uint64_t ret_ref = 0;
9310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9312         return ret_ref;
9313 }
9314
9315 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9316 CHECK(!owner->result_ok);
9317         return DecodeError_clone(&*owner->contents.err);
9318 }
9319 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
9320         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9321         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9322         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9323         uint64_t ret_ref = tag_ptr(ret_copy, true);
9324         return ret_ref;
9325 }
9326
9327 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9328         LDKOpenChannelV2 ret = *owner->contents.result;
9329         ret.is_owned = false;
9330         return ret;
9331 }
9332 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
9333         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9334         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
9335         uint64_t ret_ref = 0;
9336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9338         return ret_ref;
9339 }
9340
9341 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9342 CHECK(!owner->result_ok);
9343         return DecodeError_clone(&*owner->contents.err);
9344 }
9345 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
9346         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9347         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9348         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
9349         uint64_t ret_ref = tag_ptr(ret_copy, true);
9350         return ret_ref;
9351 }
9352
9353 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9354         LDKRevokeAndACK ret = *owner->contents.result;
9355         ret.is_owned = false;
9356         return ret;
9357 }
9358 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
9359         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9360         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9361         uint64_t ret_ref = 0;
9362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9364         return ret_ref;
9365 }
9366
9367 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9368 CHECK(!owner->result_ok);
9369         return DecodeError_clone(&*owner->contents.err);
9370 }
9371 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
9372         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9374         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9375         uint64_t ret_ref = tag_ptr(ret_copy, true);
9376         return ret_ref;
9377 }
9378
9379 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9380         LDKShutdown ret = *owner->contents.result;
9381         ret.is_owned = false;
9382         return ret;
9383 }
9384 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
9385         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9386         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9387         uint64_t ret_ref = 0;
9388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9390         return ret_ref;
9391 }
9392
9393 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9394 CHECK(!owner->result_ok);
9395         return DecodeError_clone(&*owner->contents.err);
9396 }
9397 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
9398         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9400         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9401         uint64_t ret_ref = tag_ptr(ret_copy, true);
9402         return ret_ref;
9403 }
9404
9405 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9406         LDKUpdateFailHTLC ret = *owner->contents.result;
9407         ret.is_owned = false;
9408         return ret;
9409 }
9410 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9411         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9412         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9413         uint64_t ret_ref = 0;
9414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9416         return ret_ref;
9417 }
9418
9419 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9420 CHECK(!owner->result_ok);
9421         return DecodeError_clone(&*owner->contents.err);
9422 }
9423 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
9424         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9426         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9427         uint64_t ret_ref = tag_ptr(ret_copy, true);
9428         return ret_ref;
9429 }
9430
9431 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9432         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
9433         ret.is_owned = false;
9434         return ret;
9435 }
9436 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9437         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9438         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9439         uint64_t ret_ref = 0;
9440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9442         return ret_ref;
9443 }
9444
9445 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9446 CHECK(!owner->result_ok);
9447         return DecodeError_clone(&*owner->contents.err);
9448 }
9449 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9450         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9451         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9452         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9453         uint64_t ret_ref = tag_ptr(ret_copy, true);
9454         return ret_ref;
9455 }
9456
9457 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9458         LDKUpdateFee ret = *owner->contents.result;
9459         ret.is_owned = false;
9460         return ret;
9461 }
9462 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
9463         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9464         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9465         uint64_t ret_ref = 0;
9466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9468         return ret_ref;
9469 }
9470
9471 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9472 CHECK(!owner->result_ok);
9473         return DecodeError_clone(&*owner->contents.err);
9474 }
9475 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
9476         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9478         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9479         uint64_t ret_ref = tag_ptr(ret_copy, true);
9480         return ret_ref;
9481 }
9482
9483 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9484         LDKUpdateFulfillHTLC ret = *owner->contents.result;
9485         ret.is_owned = false;
9486         return ret;
9487 }
9488 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9489         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9490         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9491         uint64_t ret_ref = 0;
9492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9494         return ret_ref;
9495 }
9496
9497 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9498 CHECK(!owner->result_ok);
9499         return DecodeError_clone(&*owner->contents.err);
9500 }
9501 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
9502         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9503         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9504         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9505         uint64_t ret_ref = tag_ptr(ret_copy, true);
9506         return ret_ref;
9507 }
9508
9509 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9510         LDKUpdateAddHTLC ret = *owner->contents.result;
9511         ret.is_owned = false;
9512         return ret;
9513 }
9514 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9515         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9516         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9517         uint64_t ret_ref = 0;
9518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9520         return ret_ref;
9521 }
9522
9523 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9524 CHECK(!owner->result_ok);
9525         return DecodeError_clone(&*owner->contents.err);
9526 }
9527 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
9528         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9529         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9530         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9531         uint64_t ret_ref = tag_ptr(ret_copy, true);
9532         return ret_ref;
9533 }
9534
9535 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9536         LDKOnionMessage ret = *owner->contents.result;
9537         ret.is_owned = false;
9538         return ret;
9539 }
9540 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
9541         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9542         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9543         uint64_t ret_ref = 0;
9544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9546         return ret_ref;
9547 }
9548
9549 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9550 CHECK(!owner->result_ok);
9551         return DecodeError_clone(&*owner->contents.err);
9552 }
9553 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
9554         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9555         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9556         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9557         uint64_t ret_ref = tag_ptr(ret_copy, true);
9558         return ret_ref;
9559 }
9560
9561 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9562         LDKPing ret = *owner->contents.result;
9563         ret.is_owned = false;
9564         return ret;
9565 }
9566 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
9567         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9568         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9569         uint64_t ret_ref = 0;
9570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9572         return ret_ref;
9573 }
9574
9575 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9576 CHECK(!owner->result_ok);
9577         return DecodeError_clone(&*owner->contents.err);
9578 }
9579 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
9580         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9581         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9582         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9583         uint64_t ret_ref = tag_ptr(ret_copy, true);
9584         return ret_ref;
9585 }
9586
9587 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9588         LDKPong ret = *owner->contents.result;
9589         ret.is_owned = false;
9590         return ret;
9591 }
9592 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
9593         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9594         LDKPong ret_var = CResult_PongDecodeErrorZ_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_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9602 CHECK(!owner->result_ok);
9603         return DecodeError_clone(&*owner->contents.err);
9604 }
9605 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
9606         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9608         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9609         uint64_t ret_ref = tag_ptr(ret_copy, true);
9610         return ret_ref;
9611 }
9612
9613 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9614         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9615         ret.is_owned = false;
9616         return ret;
9617 }
9618 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9619         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9620         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_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_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9628 CHECK(!owner->result_ok);
9629         return DecodeError_clone(&*owner->contents.err);
9630 }
9631 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9632         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9633         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9634         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9635         uint64_t ret_ref = tag_ptr(ret_copy, true);
9636         return ret_ref;
9637 }
9638
9639 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9640         LDKChannelAnnouncement ret = *owner->contents.result;
9641         ret.is_owned = false;
9642         return ret;
9643 }
9644 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9645         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9646         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_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_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9654 CHECK(!owner->result_ok);
9655         return DecodeError_clone(&*owner->contents.err);
9656 }
9657 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9658         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9659         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9660         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9661         uint64_t ret_ref = tag_ptr(ret_copy, true);
9662         return ret_ref;
9663 }
9664
9665 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9666         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9667         ret.is_owned = false;
9668         return ret;
9669 }
9670 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9671         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9672         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_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_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9680 CHECK(!owner->result_ok);
9681         return DecodeError_clone(&*owner->contents.err);
9682 }
9683 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9684         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9685         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9686         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9687         uint64_t ret_ref = tag_ptr(ret_copy, true);
9688         return ret_ref;
9689 }
9690
9691 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9692         LDKChannelUpdate ret = *owner->contents.result;
9693         ret.is_owned = false;
9694         return ret;
9695 }
9696 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9697         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9698         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_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_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9706 CHECK(!owner->result_ok);
9707         return DecodeError_clone(&*owner->contents.err);
9708 }
9709 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9710         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9711         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9712         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9713         uint64_t ret_ref = tag_ptr(ret_copy, true);
9714         return ret_ref;
9715 }
9716
9717 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9718         LDKErrorMessage ret = *owner->contents.result;
9719         ret.is_owned = false;
9720         return ret;
9721 }
9722 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
9723         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9724         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_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_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9732 CHECK(!owner->result_ok);
9733         return DecodeError_clone(&*owner->contents.err);
9734 }
9735 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
9736         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9737         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9738         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9739         uint64_t ret_ref = tag_ptr(ret_copy, true);
9740         return ret_ref;
9741 }
9742
9743 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9744         LDKWarningMessage ret = *owner->contents.result;
9745         ret.is_owned = false;
9746         return ret;
9747 }
9748 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
9749         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9750         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_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_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9758 CHECK(!owner->result_ok);
9759         return DecodeError_clone(&*owner->contents.err);
9760 }
9761 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
9762         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9763         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9764         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9765         uint64_t ret_ref = tag_ptr(ret_copy, true);
9766         return ret_ref;
9767 }
9768
9769 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9770         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9771         ret.is_owned = false;
9772         return ret;
9773 }
9774 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9775         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9776         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_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_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9784 CHECK(!owner->result_ok);
9785         return DecodeError_clone(&*owner->contents.err);
9786 }
9787 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9788         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9789         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9790         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9791         uint64_t ret_ref = tag_ptr(ret_copy, true);
9792         return ret_ref;
9793 }
9794
9795 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9796         LDKNodeAnnouncement ret = *owner->contents.result;
9797         ret.is_owned = false;
9798         return ret;
9799 }
9800 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9801         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9802         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_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 struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9810 CHECK(!owner->result_ok);
9811         return DecodeError_clone(&*owner->contents.err);
9812 }
9813 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9814         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9816         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9817         uint64_t ret_ref = tag_ptr(ret_copy, true);
9818         return ret_ref;
9819 }
9820
9821 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9822         LDKQueryShortChannelIds ret = *owner->contents.result;
9823         ret.is_owned = false;
9824         return ret;
9825 }
9826 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
9827         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9828         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9829         uint64_t ret_ref = 0;
9830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9832         return ret_ref;
9833 }
9834
9835 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9836 CHECK(!owner->result_ok);
9837         return DecodeError_clone(&*owner->contents.err);
9838 }
9839 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
9840         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9841         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9842         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9843         uint64_t ret_ref = tag_ptr(ret_copy, true);
9844         return ret_ref;
9845 }
9846
9847 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9848         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
9849         ret.is_owned = false;
9850         return ret;
9851 }
9852 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
9853         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9854         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9855         uint64_t ret_ref = 0;
9856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9858         return ret_ref;
9859 }
9860
9861 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9862 CHECK(!owner->result_ok);
9863         return DecodeError_clone(&*owner->contents.err);
9864 }
9865 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
9866         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9867         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9868         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9869         uint64_t ret_ref = tag_ptr(ret_copy, true);
9870         return ret_ref;
9871 }
9872
9873 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9874         LDKQueryChannelRange ret = *owner->contents.result;
9875         ret.is_owned = false;
9876         return ret;
9877 }
9878 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
9879         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9880         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9881         uint64_t ret_ref = 0;
9882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9884         return ret_ref;
9885 }
9886
9887 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9888 CHECK(!owner->result_ok);
9889         return DecodeError_clone(&*owner->contents.err);
9890 }
9891 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
9892         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9893         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9894         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9895         uint64_t ret_ref = tag_ptr(ret_copy, true);
9896         return ret_ref;
9897 }
9898
9899 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9900         LDKReplyChannelRange ret = *owner->contents.result;
9901         ret.is_owned = false;
9902         return ret;
9903 }
9904 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
9905         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9906         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9907         uint64_t ret_ref = 0;
9908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9910         return ret_ref;
9911 }
9912
9913 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9914 CHECK(!owner->result_ok);
9915         return DecodeError_clone(&*owner->contents.err);
9916 }
9917 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
9918         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9919         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9920         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9921         uint64_t ret_ref = tag_ptr(ret_copy, true);
9922         return ret_ref;
9923 }
9924
9925 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9926         LDKGossipTimestampFilter ret = *owner->contents.result;
9927         ret.is_owned = false;
9928         return ret;
9929 }
9930 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
9931         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9932         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9933         uint64_t ret_ref = 0;
9934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9936         return ret_ref;
9937 }
9938
9939 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9940 CHECK(!owner->result_ok);
9941         return DecodeError_clone(&*owner->contents.err);
9942 }
9943 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
9944         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9945         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9946         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9947         uint64_t ret_ref = tag_ptr(ret_copy, true);
9948         return ret_ref;
9949 }
9950
9951 uint32_t __attribute__((export_name("TS_LDKCOption_KeyPairZ_ty_from_ptr"))) TS_LDKCOption_KeyPairZ_ty_from_ptr(uint64_t ptr) {
9952         LDKCOption_KeyPairZ *obj = (LDKCOption_KeyPairZ*)untag_ptr(ptr);
9953         switch(obj->tag) {
9954                 case LDKCOption_KeyPairZ_Some: return 0;
9955                 case LDKCOption_KeyPairZ_None: return 1;
9956                 default: abort();
9957         }
9958 }
9959 int8_tArray __attribute__((export_name("TS_LDKCOption_KeyPairZ_Some_get_some"))) TS_LDKCOption_KeyPairZ_Some_get_some(uint64_t ptr) {
9960         LDKCOption_KeyPairZ *obj = (LDKCOption_KeyPairZ*)untag_ptr(ptr);
9961         assert(obj->tag == LDKCOption_KeyPairZ_Some);
9962                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
9963                         memcpy(some_arr->elems, obj->some.bytes, 32);
9964         return some_arr;
9965 }
9966 static inline struct LDKCOption_KeyPairZ CResult_COption_KeyPairZNoneZ_get_ok(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR owner){
9967 CHECK(owner->result_ok);
9968         return COption_KeyPairZ_clone(&*owner->contents.result);
9969 }
9970 uint64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_get_ok"))) TS_CResult_COption_KeyPairZNoneZ_get_ok(uint64_t owner) {
9971         LDKCResult_COption_KeyPairZNoneZ* owner_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(owner);
9972         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
9973         *ret_copy = CResult_COption_KeyPairZNoneZ_get_ok(owner_conv);
9974         uint64_t ret_ref = tag_ptr(ret_copy, true);
9975         return ret_ref;
9976 }
9977
9978 static inline void CResult_COption_KeyPairZNoneZ_get_err(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR owner){
9979 CHECK(!owner->result_ok);
9980         return *owner->contents.err;
9981 }
9982 void  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_get_err"))) TS_CResult_COption_KeyPairZNoneZ_get_err(uint64_t owner) {
9983         LDKCResult_COption_KeyPairZNoneZ* owner_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(owner);
9984         CResult_COption_KeyPairZNoneZ_get_err(owner_conv);
9985 }
9986
9987 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
9988         LDKInvoiceError ret = *owner->contents.result;
9989         ret.is_owned = false;
9990         return ret;
9991 }
9992 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
9993         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
9994         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
9995         uint64_t ret_ref = 0;
9996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9998         return ret_ref;
9999 }
10000
10001 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
10002 CHECK(!owner->result_ok);
10003         return DecodeError_clone(&*owner->contents.err);
10004 }
10005 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
10006         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
10007         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10008         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
10009         uint64_t ret_ref = tag_ptr(ret_copy, true);
10010         return ret_ref;
10011 }
10012
10013 typedef struct LDKFilter_JCalls {
10014         atomic_size_t refcnt;
10015         uint32_t instance_ptr;
10016 } LDKFilter_JCalls;
10017 static void LDKFilter_JCalls_free(void* this_arg) {
10018         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10019         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10020                 FREE(j_calls);
10021         }
10022 }
10023 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
10024         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10025         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
10026         memcpy(txid_arr->elems, *txid, 32);
10027         LDKu8slice script_pubkey_var = script_pubkey;
10028         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
10029         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
10030         js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
10031 }
10032 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
10033         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10034         LDKWatchedOutput output_var = output;
10035         uint64_t output_ref = 0;
10036         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
10037         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
10038         js_invoke_function_buuuuu(j_calls->instance_ptr, 42, output_ref, 0, 0, 0, 0, 0);
10039 }
10040 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
10041         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
10042         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10043 }
10044 static inline LDKFilter LDKFilter_init (JSValue o) {
10045         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
10046         atomic_init(&calls->refcnt, 1);
10047         calls->instance_ptr = o;
10048
10049         LDKFilter ret = {
10050                 .this_arg = (void*) calls,
10051                 .register_tx = register_tx_LDKFilter_jcall,
10052                 .register_output = register_output_LDKFilter_jcall,
10053                 .free = LDKFilter_JCalls_free,
10054         };
10055         return ret;
10056 }
10057 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
10058         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10059         *res_ptr = LDKFilter_init(o);
10060         return tag_ptr(res_ptr, true);
10061 }
10062 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
10063         void* this_arg_ptr = untag_ptr(this_arg);
10064         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10065         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10066         uint8_t txid_arr[32];
10067         CHECK(txid->arr_len == 32);
10068         memcpy(txid_arr, txid->elems, 32); FREE(txid);
10069         uint8_t (*txid_ref)[32] = &txid_arr;
10070         LDKu8slice script_pubkey_ref;
10071         script_pubkey_ref.datalen = script_pubkey->arr_len;
10072         script_pubkey_ref.data = script_pubkey->elems;
10073         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
10074         FREE(script_pubkey);
10075 }
10076
10077 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
10078         void* this_arg_ptr = untag_ptr(this_arg);
10079         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10080         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10081         LDKWatchedOutput output_conv;
10082         output_conv.inner = untag_ptr(output);
10083         output_conv.is_owned = ptr_is_owned(output);
10084         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
10085         output_conv = WatchedOutput_clone(&output_conv);
10086         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
10087 }
10088
10089 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
10090         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
10091         switch(obj->tag) {
10092                 case LDKCOption_FilterZ_Some: return 0;
10093                 case LDKCOption_FilterZ_None: return 1;
10094                 default: abort();
10095         }
10096 }
10097 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
10098         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
10099         assert(obj->tag == LDKCOption_FilterZ_Some);
10100                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
10101                         *some_ret = obj->some;
10102                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
10103                         if ((*some_ret).free == LDKFilter_JCalls_free) {
10104                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10105                                 LDKFilter_JCalls_cloned(&(*some_ret));
10106                         }
10107         return tag_ptr(some_ret, true);
10108 }
10109 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10110         LDKLockedChannelMonitor ret = *owner->contents.result;
10111         ret.is_owned = false;
10112         return ret;
10113 }
10114 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
10115         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
10116         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
10117         uint64_t ret_ref = 0;
10118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10120         return ret_ref;
10121 }
10122
10123 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10124 CHECK(!owner->result_ok);
10125         return *owner->contents.err;
10126 }
10127 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
10128         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
10129         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
10130 }
10131
10132 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
10133         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
10134         for (size_t i = 0; i < ret.datalen; i++) {
10135                 ret.data[i] = OutPoint_clone(&orig->data[i]);
10136         }
10137         return ret;
10138 }
10139 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
10140         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
10141         for (size_t i = 0; i < ret.datalen; i++) {
10142                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
10143         }
10144         return ret;
10145 }
10146 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
10147         LDKOutPoint ret = owner->a;
10148         ret.is_owned = false;
10149         return ret;
10150 }
10151 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
10152         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
10153         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
10154         uint64_t ret_ref = 0;
10155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10157         return ret_ref;
10158 }
10159
10160 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
10161         return CVec_MonitorUpdateIdZ_clone(&owner->b);
10162 }
10163 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
10164         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
10165         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
10166         uint64_tArray ret_arr = NULL;
10167         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10168         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10169         for (size_t r = 0; r < ret_var.datalen; r++) {
10170                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
10171                 uint64_t ret_conv_17_ref = 0;
10172                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
10173                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
10174                 ret_arr_ptr[r] = ret_conv_17_ref;
10175         }
10176         
10177         FREE(ret_var.data);
10178         return ret_arr;
10179 }
10180
10181 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
10182         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
10183         for (size_t i = 0; i < ret.datalen; i++) {
10184                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
10185         }
10186         return ret;
10187 }
10188 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10189         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10190         for (size_t i = 0; i < ret.datalen; i++) {
10191                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10192         }
10193         return ret;
10194 }
10195 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
10196         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10197         switch(obj->tag) {
10198                 case LDKSignOrCreationError_SignError: return 0;
10199                 case LDKSignOrCreationError_CreationError: return 1;
10200                 default: abort();
10201         }
10202 }
10203 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
10204         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10205         assert(obj->tag == LDKSignOrCreationError_CreationError);
10206                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
10207         return creation_error_conv;
10208 }
10209 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10210         LDKBolt11Invoice ret = *owner->contents.result;
10211         ret.is_owned = false;
10212         return ret;
10213 }
10214 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
10215         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10216         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10217         uint64_t ret_ref = 0;
10218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10220         return ret_ref;
10221 }
10222
10223 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10224 CHECK(!owner->result_ok);
10225         return SignOrCreationError_clone(&*owner->contents.err);
10226 }
10227 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
10228         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10229         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10230         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10231         uint64_t ret_ref = tag_ptr(ret_copy, true);
10232         return ret_ref;
10233 }
10234
10235 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
10236         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10237         switch(obj->tag) {
10238                 case LDKBolt11ParseError_Bech32Error: return 0;
10239                 case LDKBolt11ParseError_ParseAmountError: return 1;
10240                 case LDKBolt11ParseError_MalformedSignature: return 2;
10241                 case LDKBolt11ParseError_BadPrefix: return 3;
10242                 case LDKBolt11ParseError_UnknownCurrency: return 4;
10243                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
10244                 case LDKBolt11ParseError_MalformedHRP: return 6;
10245                 case LDKBolt11ParseError_TooShortDataPart: return 7;
10246                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
10247                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
10248                 case LDKBolt11ParseError_PaddingError: return 10;
10249                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
10250                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
10251                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
10252                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
10253                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
10254                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
10255                 case LDKBolt11ParseError_Skip: return 17;
10256                 default: abort();
10257         }
10258 }
10259 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
10260         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10261         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
10262                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
10263         return bech32_error_ref;
10264 }
10265 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
10266         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10267         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
10268                         /*obj->parse_amount_error*/
10269         return 0;
10270 }
10271 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
10272         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10273         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
10274                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
10275         return malformed_signature_conv;
10276 }
10277 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
10278         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10279         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
10280                         /*obj->description_decode_error*/
10281         return 0;
10282 }
10283 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
10284         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10285         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
10286                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
10287                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
10288         return invalid_slice_length_conv;
10289 }
10290 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10291 CHECK(owner->result_ok);
10292         return SiPrefix_clone(&*owner->contents.result);
10293 }
10294 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
10295         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10296         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
10297         return ret_conv;
10298 }
10299
10300 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10301 CHECK(!owner->result_ok);
10302         return Bolt11ParseError_clone(&*owner->contents.err);
10303 }
10304 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
10305         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10306         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10307         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
10308         uint64_t ret_ref = tag_ptr(ret_copy, true);
10309         return ret_ref;
10310 }
10311
10312 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
10313         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10314         switch(obj->tag) {
10315                 case LDKParseOrSemanticError_ParseError: return 0;
10316                 case LDKParseOrSemanticError_SemanticError: return 1;
10317                 default: abort();
10318         }
10319 }
10320 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
10321         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10322         assert(obj->tag == LDKParseOrSemanticError_ParseError);
10323                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
10324         return parse_error_ref;
10325 }
10326 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
10327         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10328         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
10329                         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
10330         return semantic_error_conv;
10331 }
10332 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10333         LDKBolt11Invoice ret = *owner->contents.result;
10334         ret.is_owned = false;
10335         return ret;
10336 }
10337 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
10338         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10339         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
10340         uint64_t ret_ref = 0;
10341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10343         return ret_ref;
10344 }
10345
10346 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10347 CHECK(!owner->result_ok);
10348         return ParseOrSemanticError_clone(&*owner->contents.err);
10349 }
10350 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
10351         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10352         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
10353         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
10354         uint64_t ret_ref = tag_ptr(ret_copy, true);
10355         return ret_ref;
10356 }
10357
10358 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10359         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
10360         ret.is_owned = false;
10361         return ret;
10362 }
10363 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
10364         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10365         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
10366         uint64_t ret_ref = 0;
10367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10369         return ret_ref;
10370 }
10371
10372 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10373 CHECK(!owner->result_ok);
10374         return Bolt11ParseError_clone(&*owner->contents.err);
10375 }
10376 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
10377         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10378         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10379         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
10380         uint64_t ret_ref = tag_ptr(ret_copy, true);
10381         return ret_ref;
10382 }
10383
10384 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10385         LDKRawBolt11Invoice ret = owner->a;
10386         ret.is_owned = false;
10387         return ret;
10388 }
10389 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
10390         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10391         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
10392         uint64_t ret_ref = 0;
10393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10395         return ret_ref;
10396 }
10397
10398 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10399         return ThirtyTwoBytes_clone(&owner->b);
10400 }
10401 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
10402         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10403         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10404         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
10405         return ret_arr;
10406 }
10407
10408 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10409         LDKBolt11InvoiceSignature ret = owner->c;
10410         ret.is_owned = false;
10411         return ret;
10412 }
10413 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
10414         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10415         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
10416         uint64_t ret_ref = 0;
10417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10419         return ret_ref;
10420 }
10421
10422 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
10423         LDKPayeePubKey ret = *owner->contents.result;
10424         ret.is_owned = false;
10425         return ret;
10426 }
10427 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
10428         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
10429         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
10430         uint64_t ret_ref = 0;
10431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10433         return ret_ref;
10434 }
10435
10436 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
10437 CHECK(!owner->result_ok);
10438         return *owner->contents.err;
10439 }
10440 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
10441         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
10442         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
10443         return ret_conv;
10444 }
10445
10446 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
10447         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
10448         for (size_t i = 0; i < ret.datalen; i++) {
10449                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
10450         }
10451         return ret;
10452 }
10453 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10454         LDKPositiveTimestamp ret = *owner->contents.result;
10455         ret.is_owned = false;
10456         return ret;
10457 }
10458 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
10459         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10460         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
10461         uint64_t ret_ref = 0;
10462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10464         return ret_ref;
10465 }
10466
10467 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10468 CHECK(!owner->result_ok);
10469         return CreationError_clone(&*owner->contents.err);
10470 }
10471 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
10472         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10473         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
10474         return ret_conv;
10475 }
10476
10477 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10478 CHECK(owner->result_ok);
10479         return *owner->contents.result;
10480 }
10481 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10482         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10483         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
10484 }
10485
10486 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10487 CHECK(!owner->result_ok);
10488         return Bolt11SemanticError_clone(&*owner->contents.err);
10489 }
10490 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
10491         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10492         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
10493         return ret_conv;
10494 }
10495
10496 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10497         LDKBolt11Invoice ret = *owner->contents.result;
10498         ret.is_owned = false;
10499         return ret;
10500 }
10501 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10502         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10503         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
10504         uint64_t ret_ref = 0;
10505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10507         return ret_ref;
10508 }
10509
10510 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10511 CHECK(!owner->result_ok);
10512         return Bolt11SemanticError_clone(&*owner->contents.err);
10513 }
10514 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
10515         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10516         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
10517         return ret_conv;
10518 }
10519
10520 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10521         LDKDescription ret = *owner->contents.result;
10522         ret.is_owned = false;
10523         return ret;
10524 }
10525 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
10526         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10527         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
10528         uint64_t ret_ref = 0;
10529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10531         return ret_ref;
10532 }
10533
10534 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10535 CHECK(!owner->result_ok);
10536         return CreationError_clone(&*owner->contents.err);
10537 }
10538 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
10539         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10540         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
10541         return ret_conv;
10542 }
10543
10544 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10545         LDKPrivateRoute ret = *owner->contents.result;
10546         ret.is_owned = false;
10547         return ret;
10548 }
10549 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
10550         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10551         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
10552         uint64_t ret_ref = 0;
10553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10555         return ret_ref;
10556 }
10557
10558 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10559 CHECK(!owner->result_ok);
10560         return CreationError_clone(&*owner->contents.err);
10561 }
10562 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
10563         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10564         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
10565         return ret_conv;
10566 }
10567
10568 typedef struct LDKScore_JCalls {
10569         atomic_size_t refcnt;
10570         uint32_t instance_ptr;
10571 } LDKScore_JCalls;
10572 static void LDKScore_JCalls_free(void* this_arg) {
10573         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10574         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10575                 FREE(j_calls);
10576         }
10577 }
10578 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
10579         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10580         int64_t short_channel_id_conv = short_channel_id;
10581         LDKNodeId source_var = *source;
10582         uint64_t source_ref = 0;
10583         source_var = NodeId_clone(&source_var);
10584         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
10585         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
10586         LDKNodeId target_var = *target;
10587         uint64_t target_ref = 0;
10588         target_var = NodeId_clone(&target_var);
10589         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
10590         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
10591         LDKChannelUsage usage_var = usage;
10592         uint64_t usage_ref = 0;
10593         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
10594         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
10595         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
10596         uint64_t score_params_ref = 0;
10597         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
10598         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
10599         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
10600         return js_invoke_function_bbbbbu(j_calls->instance_ptr, 43, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref, 0);
10601 }
10602 void payment_path_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
10603         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10604         LDKPath path_var = *path;
10605         uint64_t path_ref = 0;
10606         path_var = Path_clone(&path_var);
10607         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10608         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
10609         int64_t short_channel_id_conv = short_channel_id;
10610         js_invoke_function_bbuuuu(j_calls->instance_ptr, 44, path_ref, short_channel_id_conv, 0, 0, 0, 0);
10611 }
10612 void payment_path_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
10613         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10614         LDKPath path_var = *path;
10615         uint64_t path_ref = 0;
10616         path_var = Path_clone(&path_var);
10617         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10618         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
10619         js_invoke_function_buuuuu(j_calls->instance_ptr, 45, path_ref, 0, 0, 0, 0, 0);
10620 }
10621 void probe_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
10622         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10623         LDKPath path_var = *path;
10624         uint64_t path_ref = 0;
10625         path_var = Path_clone(&path_var);
10626         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10627         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
10628         int64_t short_channel_id_conv = short_channel_id;
10629         js_invoke_function_bbuuuu(j_calls->instance_ptr, 46, path_ref, short_channel_id_conv, 0, 0, 0, 0);
10630 }
10631 void probe_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
10632         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10633         LDKPath path_var = *path;
10634         uint64_t path_ref = 0;
10635         path_var = Path_clone(&path_var);
10636         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10637         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
10638         js_invoke_function_buuuuu(j_calls->instance_ptr, 47, path_ref, 0, 0, 0, 0, 0);
10639 }
10640 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
10641         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10642         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, 0, 0, 0, 0, 0, 0);
10643         LDKCVec_u8Z ret_ref;
10644         ret_ref.datalen = ret->arr_len;
10645         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10646         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
10647         return ret_ref;
10648 }
10649 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10650         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10651         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10652 }
10653 static inline LDKScore LDKScore_init (JSValue o) {
10654         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10655         atomic_init(&calls->refcnt, 1);
10656         calls->instance_ptr = o;
10657
10658         LDKScore ret = {
10659                 .this_arg = (void*) calls,
10660                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10661                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10662                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10663                 .probe_failed = probe_failed_LDKScore_jcall,
10664                 .probe_successful = probe_successful_LDKScore_jcall,
10665                 .write = write_LDKScore_jcall,
10666                 .free = LDKScore_JCalls_free,
10667         };
10668         return ret;
10669 }
10670 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
10671         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10672         *res_ptr = LDKScore_init(o);
10673         return tag_ptr(res_ptr, true);
10674 }
10675 int64_t  __attribute__((export_name("TS_Score_channel_penalty_msat"))) TS_Score_channel_penalty_msat(uint64_t this_arg, int64_t short_channel_id, uint64_t source, uint64_t target, uint64_t usage, uint64_t score_params) {
10676         void* this_arg_ptr = untag_ptr(this_arg);
10677         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10678         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10679         LDKNodeId source_conv;
10680         source_conv.inner = untag_ptr(source);
10681         source_conv.is_owned = ptr_is_owned(source);
10682         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10683         source_conv.is_owned = false;
10684         LDKNodeId target_conv;
10685         target_conv.inner = untag_ptr(target);
10686         target_conv.is_owned = ptr_is_owned(target);
10687         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10688         target_conv.is_owned = false;
10689         LDKChannelUsage usage_conv;
10690         usage_conv.inner = untag_ptr(usage);
10691         usage_conv.is_owned = ptr_is_owned(usage);
10692         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
10693         usage_conv = ChannelUsage_clone(&usage_conv);
10694         LDKProbabilisticScoringFeeParameters score_params_conv;
10695         score_params_conv.inner = untag_ptr(score_params);
10696         score_params_conv.is_owned = ptr_is_owned(score_params);
10697         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
10698         score_params_conv.is_owned = false;
10699         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv, &score_params_conv);
10700         return ret_conv;
10701 }
10702
10703 void  __attribute__((export_name("TS_Score_payment_path_failed"))) TS_Score_payment_path_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
10704         void* this_arg_ptr = untag_ptr(this_arg);
10705         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10706         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10707         LDKPath path_conv;
10708         path_conv.inner = untag_ptr(path);
10709         path_conv.is_owned = ptr_is_owned(path);
10710         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
10711         path_conv.is_owned = false;
10712         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
10713 }
10714
10715 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_t path) {
10716         void* this_arg_ptr = untag_ptr(this_arg);
10717         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10718         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10719         LDKPath path_conv;
10720         path_conv.inner = untag_ptr(path);
10721         path_conv.is_owned = ptr_is_owned(path);
10722         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
10723         path_conv.is_owned = false;
10724         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
10725 }
10726
10727 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
10728         void* this_arg_ptr = untag_ptr(this_arg);
10729         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10730         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10731         LDKPath path_conv;
10732         path_conv.inner = untag_ptr(path);
10733         path_conv.is_owned = ptr_is_owned(path);
10734         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
10735         path_conv.is_owned = false;
10736         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
10737 }
10738
10739 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_t path) {
10740         void* this_arg_ptr = untag_ptr(this_arg);
10741         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10742         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10743         LDKPath path_conv;
10744         path_conv.inner = untag_ptr(path);
10745         path_conv.is_owned = ptr_is_owned(path);
10746         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
10747         path_conv.is_owned = false;
10748         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
10749 }
10750
10751 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
10752         void* this_arg_ptr = untag_ptr(this_arg);
10753         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10754         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10755         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10756         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
10757         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
10758         CVec_u8Z_free(ret_var);
10759         return ret_arr;
10760 }
10761
10762 typedef struct LDKLockableScore_JCalls {
10763         atomic_size_t refcnt;
10764         uint32_t instance_ptr;
10765 } LDKLockableScore_JCalls;
10766 static void LDKLockableScore_JCalls_free(void* this_arg) {
10767         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10768         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10769                 FREE(j_calls);
10770         }
10771 }
10772 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
10773         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10774         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
10775         void* ret_ptr = untag_ptr(ret);
10776         CHECK_ACCESS(ret_ptr);
10777         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
10778         if (ret_conv.free == LDKScore_JCalls_free) {
10779                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10780                 LDKScore_JCalls_cloned(&ret_conv);
10781         }// WARNING: we may need a move here but no clone is available for LDKScore
10782         
10783         return ret_conv;
10784 }
10785 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
10786         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
10787         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10788 }
10789 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
10790         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
10791         atomic_init(&calls->refcnt, 1);
10792         calls->instance_ptr = o;
10793
10794         LDKLockableScore ret = {
10795                 .this_arg = (void*) calls,
10796                 .lock = lock_LDKLockableScore_jcall,
10797                 .free = LDKLockableScore_JCalls_free,
10798         };
10799         return ret;
10800 }
10801 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
10802         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
10803         *res_ptr = LDKLockableScore_init(o);
10804         return tag_ptr(res_ptr, true);
10805 }
10806 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
10807         void* this_arg_ptr = untag_ptr(this_arg);
10808         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10809         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
10810         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
10811         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
10812         return tag_ptr(ret_ret, true);
10813 }
10814
10815 typedef struct LDKWriteableScore_JCalls {
10816         atomic_size_t refcnt;
10817         uint32_t instance_ptr;
10818         LDKLockableScore_JCalls* LockableScore;
10819 } LDKWriteableScore_JCalls;
10820 static void LDKWriteableScore_JCalls_free(void* this_arg) {
10821         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
10822         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10823                 FREE(j_calls);
10824         }
10825 }
10826 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
10827         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
10828         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0);
10829         LDKCVec_u8Z ret_ref;
10830         ret_ref.datalen = ret->arr_len;
10831         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10832         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
10833         return ret_ref;
10834 }
10835 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
10836         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
10837         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10838         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
10839 }
10840 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
10841         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
10842         atomic_init(&calls->refcnt, 1);
10843         calls->instance_ptr = o;
10844
10845         LDKWriteableScore ret = {
10846                 .this_arg = (void*) calls,
10847                 .write = write_LDKWriteableScore_jcall,
10848                 .free = LDKWriteableScore_JCalls_free,
10849                 .LockableScore = LDKLockableScore_init(LockableScore),
10850         };
10851         calls->LockableScore = ret.LockableScore.this_arg;
10852         return ret;
10853 }
10854 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
10855         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
10856         *res_ptr = LDKWriteableScore_init(o, LockableScore);
10857         return tag_ptr(res_ptr, true);
10858 }
10859 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
10860         void* this_arg_ptr = untag_ptr(this_arg);
10861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10862         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
10863         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10864         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
10865         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
10866         CVec_u8Z_free(ret_var);
10867         return ret_arr;
10868 }
10869
10870 typedef struct LDKPersister_JCalls {
10871         atomic_size_t refcnt;
10872         uint32_t instance_ptr;
10873 } LDKPersister_JCalls;
10874 static void LDKPersister_JCalls_free(void* this_arg) {
10875         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10876         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10877                 FREE(j_calls);
10878         }
10879 }
10880 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10881         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10882         LDKChannelManager channel_manager_var = *channel_manager;
10883         uint64_t channel_manager_ref = 0;
10884         // WARNING: we may need a move here but no clone is available for LDKChannelManager
10885         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
10886         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
10887         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 51, channel_manager_ref, 0, 0, 0, 0, 0);
10888         void* ret_ptr = untag_ptr(ret);
10889         CHECK_ACCESS(ret_ptr);
10890         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10891         FREE(untag_ptr(ret));
10892         return ret_conv;
10893 }
10894 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
10895         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10896         LDKNetworkGraph network_graph_var = *network_graph;
10897         uint64_t network_graph_ref = 0;
10898         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
10899         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
10900         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
10901         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, network_graph_ref, 0, 0, 0, 0, 0);
10902         void* ret_ptr = untag_ptr(ret);
10903         CHECK_ACCESS(ret_ptr);
10904         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10905         FREE(untag_ptr(ret));
10906         return ret_conv;
10907 }
10908 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
10909         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10910         // WARNING: This object doesn't live past this scope, needs clone!
10911         uint64_t ret_scorer = tag_ptr(scorer, false);
10912         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 53, ret_scorer, 0, 0, 0, 0, 0);
10913         void* ret_ptr = untag_ptr(ret);
10914         CHECK_ACCESS(ret_ptr);
10915         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10916         FREE(untag_ptr(ret));
10917         return ret_conv;
10918 }
10919 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
10920         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
10921         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10922 }
10923 static inline LDKPersister LDKPersister_init (JSValue o) {
10924         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
10925         atomic_init(&calls->refcnt, 1);
10926         calls->instance_ptr = o;
10927
10928         LDKPersister ret = {
10929                 .this_arg = (void*) calls,
10930                 .persist_manager = persist_manager_LDKPersister_jcall,
10931                 .persist_graph = persist_graph_LDKPersister_jcall,
10932                 .persist_scorer = persist_scorer_LDKPersister_jcall,
10933                 .free = LDKPersister_JCalls_free,
10934         };
10935         return ret;
10936 }
10937 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
10938         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
10939         *res_ptr = LDKPersister_init(o);
10940         return tag_ptr(res_ptr, true);
10941 }
10942 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
10943         void* this_arg_ptr = untag_ptr(this_arg);
10944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10945         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10946         LDKChannelManager channel_manager_conv;
10947         channel_manager_conv.inner = untag_ptr(channel_manager);
10948         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
10949         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10950         channel_manager_conv.is_owned = false;
10951         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10952         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10953         return tag_ptr(ret_conv, true);
10954 }
10955
10956 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
10957         void* this_arg_ptr = untag_ptr(this_arg);
10958         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10959         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10960         LDKNetworkGraph network_graph_conv;
10961         network_graph_conv.inner = untag_ptr(network_graph);
10962         network_graph_conv.is_owned = ptr_is_owned(network_graph);
10963         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
10964         network_graph_conv.is_owned = false;
10965         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10966         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
10967         return tag_ptr(ret_conv, true);
10968 }
10969
10970 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
10971         void* this_arg_ptr = untag_ptr(this_arg);
10972         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10973         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10974         void* scorer_ptr = untag_ptr(scorer);
10975         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
10976         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
10977         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10978         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
10979         return tag_ptr(ret_conv, true);
10980 }
10981
10982 typedef struct LDKFutureCallback_JCalls {
10983         atomic_size_t refcnt;
10984         uint32_t instance_ptr;
10985 } LDKFutureCallback_JCalls;
10986 static void LDKFutureCallback_JCalls_free(void* this_arg) {
10987         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
10988         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10989                 FREE(j_calls);
10990         }
10991 }
10992 void call_LDKFutureCallback_jcall(const void* this_arg) {
10993         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
10994         js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0);
10995 }
10996 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
10997         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
10998         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10999 }
11000 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
11001         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
11002         atomic_init(&calls->refcnt, 1);
11003         calls->instance_ptr = o;
11004
11005         LDKFutureCallback ret = {
11006                 .this_arg = (void*) calls,
11007                 .call = call_LDKFutureCallback_jcall,
11008                 .free = LDKFutureCallback_JCalls_free,
11009         };
11010         return ret;
11011 }
11012 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
11013         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
11014         *res_ptr = LDKFutureCallback_init(o);
11015         return tag_ptr(res_ptr, true);
11016 }
11017 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
11018         void* this_arg_ptr = untag_ptr(this_arg);
11019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11020         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
11021         (this_arg_conv->call)(this_arg_conv->this_arg);
11022 }
11023
11024 typedef struct LDKListen_JCalls {
11025         atomic_size_t refcnt;
11026         uint32_t instance_ptr;
11027 } LDKListen_JCalls;
11028 static void LDKListen_JCalls_free(void* this_arg) {
11029         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11030         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11031                 FREE(j_calls);
11032         }
11033 }
11034 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11035         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11036         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11037         memcpy(header_arr->elems, *header, 80);
11038         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11039         uint64_tArray txdata_arr = NULL;
11040         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
11041         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
11042         for (size_t c = 0; c < txdata_var.datalen; c++) {
11043                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11044                 *txdata_conv_28_conv = txdata_var.data[c];
11045                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
11046         }
11047         
11048         FREE(txdata_var.data);
11049         int32_t height_conv = height;
11050         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
11051 }
11052 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
11053         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11054         LDKu8slice block_var = block;
11055         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
11056         memcpy(block_arr->elems, block_var.data, block_var.datalen);
11057         int32_t height_conv = height;
11058         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
11059 }
11060 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11061         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11062         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11063         memcpy(header_arr->elems, *header, 80);
11064         int32_t height_conv = height;
11065         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
11066 }
11067 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
11068         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
11069         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11070 }
11071 static inline LDKListen LDKListen_init (JSValue o) {
11072         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
11073         atomic_init(&calls->refcnt, 1);
11074         calls->instance_ptr = o;
11075
11076         LDKListen ret = {
11077                 .this_arg = (void*) calls,
11078                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
11079                 .block_connected = block_connected_LDKListen_jcall,
11080                 .block_disconnected = block_disconnected_LDKListen_jcall,
11081                 .free = LDKListen_JCalls_free,
11082         };
11083         return ret;
11084 }
11085 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
11086         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
11087         *res_ptr = LDKListen_init(o);
11088         return tag_ptr(res_ptr, true);
11089 }
11090 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) {
11091         void* this_arg_ptr = untag_ptr(this_arg);
11092         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11093         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11094         uint8_t header_arr[80];
11095         CHECK(header->arr_len == 80);
11096         memcpy(header_arr, header->elems, 80); FREE(header);
11097         uint8_t (*header_ref)[80] = &header_arr;
11098         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11099         txdata_constr.datalen = txdata->arr_len;
11100         if (txdata_constr.datalen > 0)
11101                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11102         else
11103                 txdata_constr.data = NULL;
11104         uint64_t* txdata_vals = txdata->elems;
11105         for (size_t c = 0; c < txdata_constr.datalen; c++) {
11106                 uint64_t txdata_conv_28 = txdata_vals[c];
11107                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
11108                 CHECK_ACCESS(txdata_conv_28_ptr);
11109                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11110                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
11111                 txdata_constr.data[c] = txdata_conv_28_conv;
11112         }
11113         FREE(txdata);
11114         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11115 }
11116
11117 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
11118         void* this_arg_ptr = untag_ptr(this_arg);
11119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11120         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11121         LDKu8slice block_ref;
11122         block_ref.datalen = block->arr_len;
11123         block_ref.data = block->elems;
11124         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
11125         FREE(block);
11126 }
11127
11128 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
11129         void* this_arg_ptr = untag_ptr(this_arg);
11130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11131         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11132         uint8_t header_arr[80];
11133         CHECK(header->arr_len == 80);
11134         memcpy(header_arr, header->elems, 80); FREE(header);
11135         uint8_t (*header_ref)[80] = &header_arr;
11136         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
11137 }
11138
11139 typedef struct LDKConfirm_JCalls {
11140         atomic_size_t refcnt;
11141         uint32_t instance_ptr;
11142 } LDKConfirm_JCalls;
11143 static void LDKConfirm_JCalls_free(void* this_arg) {
11144         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11145         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11146                 FREE(j_calls);
11147         }
11148 }
11149 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11150         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11151         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11152         memcpy(header_arr->elems, *header, 80);
11153         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11154         uint64_tArray txdata_arr = NULL;
11155         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
11156         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
11157         for (size_t c = 0; c < txdata_var.datalen; c++) {
11158                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11159                 *txdata_conv_28_conv = txdata_var.data[c];
11160                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
11161         }
11162         
11163         FREE(txdata_var.data);
11164         int32_t height_conv = height;
11165         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
11166 }
11167 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
11168         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11169         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
11170         memcpy(txid_arr->elems, *txid, 32);
11171         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
11172 }
11173 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11174         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11175         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11176         memcpy(header_arr->elems, *header, 80);
11177         int32_t height_conv = height;
11178         js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
11179 }
11180 LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
11181         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11182         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
11183         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_constr;
11184         ret_constr.datalen = ret->arr_len;
11185         if (ret_constr.datalen > 0)
11186                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ Elements");
11187         else
11188                 ret_constr.data = NULL;
11189         uint64_t* ret_vals = ret->elems;
11190         for (size_t i = 0; i < ret_constr.datalen; i++) {
11191                 uint64_t ret_conv_34 = ret_vals[i];
11192                 void* ret_conv_34_ptr = untag_ptr(ret_conv_34);
11193                 CHECK_ACCESS(ret_conv_34_ptr);
11194                 LDKC2Tuple_TxidCOption_BlockHashZZ ret_conv_34_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(ret_conv_34_ptr);
11195                 FREE(untag_ptr(ret_conv_34));
11196                 ret_constr.data[i] = ret_conv_34_conv;
11197         }
11198         FREE(ret);
11199         return ret_constr;
11200 }
11201 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
11202         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
11203         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11204 }
11205 static inline LDKConfirm LDKConfirm_init (JSValue o) {
11206         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
11207         atomic_init(&calls->refcnt, 1);
11208         calls->instance_ptr = o;
11209
11210         LDKConfirm ret = {
11211                 .this_arg = (void*) calls,
11212                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
11213                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
11214                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
11215                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
11216                 .free = LDKConfirm_JCalls_free,
11217         };
11218         return ret;
11219 }
11220 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
11221         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
11222         *res_ptr = LDKConfirm_init(o);
11223         return tag_ptr(res_ptr, true);
11224 }
11225 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) {
11226         void* this_arg_ptr = untag_ptr(this_arg);
11227         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11228         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11229         uint8_t header_arr[80];
11230         CHECK(header->arr_len == 80);
11231         memcpy(header_arr, header->elems, 80); FREE(header);
11232         uint8_t (*header_ref)[80] = &header_arr;
11233         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11234         txdata_constr.datalen = txdata->arr_len;
11235         if (txdata_constr.datalen > 0)
11236                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11237         else
11238                 txdata_constr.data = NULL;
11239         uint64_t* txdata_vals = txdata->elems;
11240         for (size_t c = 0; c < txdata_constr.datalen; c++) {
11241                 uint64_t txdata_conv_28 = txdata_vals[c];
11242                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
11243                 CHECK_ACCESS(txdata_conv_28_ptr);
11244                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11245                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
11246                 txdata_constr.data[c] = txdata_conv_28_conv;
11247         }
11248         FREE(txdata);
11249         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11250 }
11251
11252 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
11253         void* this_arg_ptr = untag_ptr(this_arg);
11254         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11255         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11256         uint8_t txid_arr[32];
11257         CHECK(txid->arr_len == 32);
11258         memcpy(txid_arr, txid->elems, 32); FREE(txid);
11259         uint8_t (*txid_ref)[32] = &txid_arr;
11260         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
11261 }
11262
11263 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
11264         void* this_arg_ptr = untag_ptr(this_arg);
11265         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11266         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11267         uint8_t header_arr[80];
11268         CHECK(header->arr_len == 80);
11269         memcpy(header_arr, header->elems, 80); FREE(header);
11270         uint8_t (*header_ref)[80] = &header_arr;
11271         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
11272 }
11273
11274 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
11275         void* this_arg_ptr = untag_ptr(this_arg);
11276         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11277         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11278         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
11279         uint64_tArray ret_arr = NULL;
11280         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11281         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11282         for (size_t i = 0; i < ret_var.datalen; i++) {
11283                 LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv_34_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
11284                 *ret_conv_34_conv = ret_var.data[i];
11285                 ret_arr_ptr[i] = tag_ptr(ret_conv_34_conv, true);
11286         }
11287         
11288         FREE(ret_var.data);
11289         return ret_arr;
11290 }
11291
11292 typedef struct LDKPersist_JCalls {
11293         atomic_size_t refcnt;
11294         uint32_t instance_ptr;
11295 } LDKPersist_JCalls;
11296 static void LDKPersist_JCalls_free(void* this_arg) {
11297         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11298         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11299                 FREE(j_calls);
11300         }
11301 }
11302 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11303         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11304         LDKOutPoint channel_id_var = channel_id;
11305         uint64_t channel_id_ref = 0;
11306         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11307         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11308         LDKChannelMonitor data_var = *data;
11309         uint64_t data_ref = 0;
11310         data_var = ChannelMonitor_clone(&data_var);
11311         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11312         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11313         LDKMonitorUpdateId update_id_var = update_id;
11314         uint64_t update_id_ref = 0;
11315         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11316         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11317         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 62, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
11318         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
11319         return ret_conv;
11320 }
11321 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11322         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11323         LDKOutPoint channel_id_var = channel_id;
11324         uint64_t channel_id_ref = 0;
11325         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11326         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11327         LDKChannelMonitorUpdate update_var = update;
11328         uint64_t update_ref = 0;
11329         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11330         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
11331         LDKChannelMonitor data_var = *data;
11332         uint64_t data_ref = 0;
11333         data_var = ChannelMonitor_clone(&data_var);
11334         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11335         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11336         LDKMonitorUpdateId update_id_var = update_id;
11337         uint64_t update_id_ref = 0;
11338         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11339         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11340         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 63, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
11341         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
11342         return ret_conv;
11343 }
11344 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11345         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11346         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11347 }
11348 static inline LDKPersist LDKPersist_init (JSValue o) {
11349         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11350         atomic_init(&calls->refcnt, 1);
11351         calls->instance_ptr = o;
11352
11353         LDKPersist ret = {
11354                 .this_arg = (void*) calls,
11355                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11356                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11357                 .free = LDKPersist_JCalls_free,
11358         };
11359         return ret;
11360 }
11361 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
11362         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11363         *res_ptr = LDKPersist_init(o);
11364         return tag_ptr(res_ptr, true);
11365 }
11366 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) {
11367         void* this_arg_ptr = untag_ptr(this_arg);
11368         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11369         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11370         LDKOutPoint channel_id_conv;
11371         channel_id_conv.inner = untag_ptr(channel_id);
11372         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11373         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11374         channel_id_conv = OutPoint_clone(&channel_id_conv);
11375         LDKChannelMonitor data_conv;
11376         data_conv.inner = untag_ptr(data);
11377         data_conv.is_owned = ptr_is_owned(data);
11378         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11379         data_conv.is_owned = false;
11380         LDKMonitorUpdateId update_id_conv;
11381         update_id_conv.inner = untag_ptr(update_id);
11382         update_id_conv.is_owned = ptr_is_owned(update_id);
11383         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11384         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11385         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));
11386         return ret_conv;
11387 }
11388
11389 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) {
11390         void* this_arg_ptr = untag_ptr(this_arg);
11391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11392         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11393         LDKOutPoint channel_id_conv;
11394         channel_id_conv.inner = untag_ptr(channel_id);
11395         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11396         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11397         channel_id_conv = OutPoint_clone(&channel_id_conv);
11398         LDKChannelMonitorUpdate update_conv;
11399         update_conv.inner = untag_ptr(update);
11400         update_conv.is_owned = ptr_is_owned(update);
11401         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11402         update_conv = ChannelMonitorUpdate_clone(&update_conv);
11403         LDKChannelMonitor data_conv;
11404         data_conv.inner = untag_ptr(data);
11405         data_conv.is_owned = ptr_is_owned(data);
11406         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11407         data_conv.is_owned = false;
11408         LDKMonitorUpdateId update_id_conv;
11409         update_id_conv.inner = untag_ptr(update_id);
11410         update_id_conv.is_owned = ptr_is_owned(update_id);
11411         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11412         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11413         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));
11414         return ret_conv;
11415 }
11416
11417 typedef struct LDKEventHandler_JCalls {
11418         atomic_size_t refcnt;
11419         uint32_t instance_ptr;
11420 } LDKEventHandler_JCalls;
11421 static void LDKEventHandler_JCalls_free(void* this_arg) {
11422         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
11423         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11424                 FREE(j_calls);
11425         }
11426 }
11427 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
11428         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
11429         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11430         *event_copy = event;
11431         uint64_t event_ref = tag_ptr(event_copy, true);
11432         js_invoke_function_buuuuu(j_calls->instance_ptr, 64, event_ref, 0, 0, 0, 0, 0);
11433 }
11434 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
11435         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
11436         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11437 }
11438 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
11439         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
11440         atomic_init(&calls->refcnt, 1);
11441         calls->instance_ptr = o;
11442
11443         LDKEventHandler ret = {
11444                 .this_arg = (void*) calls,
11445                 .handle_event = handle_event_LDKEventHandler_jcall,
11446                 .free = LDKEventHandler_JCalls_free,
11447         };
11448         return ret;
11449 }
11450 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
11451         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
11452         *res_ptr = LDKEventHandler_init(o);
11453         return tag_ptr(res_ptr, true);
11454 }
11455 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
11456         void* this_arg_ptr = untag_ptr(this_arg);
11457         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11458         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
11459         void* event_ptr = untag_ptr(event);
11460         CHECK_ACCESS(event_ptr);
11461         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
11462         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
11463         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
11464 }
11465
11466 typedef struct LDKEventsProvider_JCalls {
11467         atomic_size_t refcnt;
11468         uint32_t instance_ptr;
11469 } LDKEventsProvider_JCalls;
11470 static void LDKEventsProvider_JCalls_free(void* this_arg) {
11471         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
11472         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11473                 FREE(j_calls);
11474         }
11475 }
11476 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
11477         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
11478         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
11479         *handler_ret = handler;
11480         js_invoke_function_buuuuu(j_calls->instance_ptr, 65, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
11481 }
11482 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
11483         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
11484         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11485 }
11486 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
11487         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
11488         atomic_init(&calls->refcnt, 1);
11489         calls->instance_ptr = o;
11490
11491         LDKEventsProvider ret = {
11492                 .this_arg = (void*) calls,
11493                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
11494                 .free = LDKEventsProvider_JCalls_free,
11495         };
11496         return ret;
11497 }
11498 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
11499         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
11500         *res_ptr = LDKEventsProvider_init(o);
11501         return tag_ptr(res_ptr, true);
11502 }
11503 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
11504         void* this_arg_ptr = untag_ptr(this_arg);
11505         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11506         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
11507         void* handler_ptr = untag_ptr(handler);
11508         CHECK_ACCESS(handler_ptr);
11509         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
11510         if (handler_conv.free == LDKEventHandler_JCalls_free) {
11511                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11512                 LDKEventHandler_JCalls_cloned(&handler_conv);
11513         }
11514         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
11515 }
11516
11517 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
11518         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11519         switch(obj->tag) {
11520                 case LDKRetry_Attempts: return 0;
11521                 default: abort();
11522         }
11523 }
11524 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
11525         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11526         assert(obj->tag == LDKRetry_Attempts);
11527                         uint32_t attempts_conv = obj->attempts;
11528         return attempts_conv;
11529 }
11530 typedef struct LDKMessageSendEventsProvider_JCalls {
11531         atomic_size_t refcnt;
11532         uint32_t instance_ptr;
11533 } LDKMessageSendEventsProvider_JCalls;
11534 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
11535         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
11536         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11537                 FREE(j_calls);
11538         }
11539 }
11540 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
11541         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
11542         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 66, 0, 0, 0, 0, 0, 0);
11543         LDKCVec_MessageSendEventZ ret_constr;
11544         ret_constr.datalen = ret->arr_len;
11545         if (ret_constr.datalen > 0)
11546                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11547         else
11548                 ret_constr.data = NULL;
11549         uint64_t* ret_vals = ret->elems;
11550         for (size_t s = 0; s < ret_constr.datalen; s++) {
11551                 uint64_t ret_conv_18 = ret_vals[s];
11552                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
11553                 CHECK_ACCESS(ret_conv_18_ptr);
11554                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
11555                 FREE(untag_ptr(ret_conv_18));
11556                 ret_constr.data[s] = ret_conv_18_conv;
11557         }
11558         FREE(ret);
11559         return ret_constr;
11560 }
11561 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
11562         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
11563         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11564 }
11565 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
11566         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
11567         atomic_init(&calls->refcnt, 1);
11568         calls->instance_ptr = o;
11569
11570         LDKMessageSendEventsProvider ret = {
11571                 .this_arg = (void*) calls,
11572                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
11573                 .free = LDKMessageSendEventsProvider_JCalls_free,
11574         };
11575         return ret;
11576 }
11577 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
11578         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
11579         *res_ptr = LDKMessageSendEventsProvider_init(o);
11580         return tag_ptr(res_ptr, true);
11581 }
11582 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) {
11583         void* this_arg_ptr = untag_ptr(this_arg);
11584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11585         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
11586         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
11587         uint64_tArray ret_arr = NULL;
11588         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11589         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11590         for (size_t s = 0; s < ret_var.datalen; s++) {
11591                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11592                 *ret_conv_18_copy = ret_var.data[s];
11593                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
11594                 ret_arr_ptr[s] = ret_conv_18_ref;
11595         }
11596         
11597         FREE(ret_var.data);
11598         return ret_arr;
11599 }
11600
11601 typedef struct LDKChannelMessageHandler_JCalls {
11602         atomic_size_t refcnt;
11603         uint32_t instance_ptr;
11604         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11605 } LDKChannelMessageHandler_JCalls;
11606 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
11607         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11608         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11609                 FREE(j_calls);
11610         }
11611 }
11612 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
11613         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11614         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11615         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11616         LDKOpenChannel msg_var = *msg;
11617         uint64_t msg_ref = 0;
11618         msg_var = OpenChannel_clone(&msg_var);
11619         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11620         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11621         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11622 }
11623 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
11624         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11625         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11626         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11627         LDKOpenChannelV2 msg_var = *msg;
11628         uint64_t msg_ref = 0;
11629         msg_var = OpenChannelV2_clone(&msg_var);
11630         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11631         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11632         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11633 }
11634 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
11635         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11636         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11637         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11638         LDKAcceptChannel msg_var = *msg;
11639         uint64_t msg_ref = 0;
11640         msg_var = AcceptChannel_clone(&msg_var);
11641         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11642         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11643         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11644 }
11645 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
11646         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11647         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11648         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11649         LDKAcceptChannelV2 msg_var = *msg;
11650         uint64_t msg_ref = 0;
11651         msg_var = AcceptChannelV2_clone(&msg_var);
11652         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11653         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11654         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11655 }
11656 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
11657         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11658         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11659         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11660         LDKFundingCreated msg_var = *msg;
11661         uint64_t msg_ref = 0;
11662         msg_var = FundingCreated_clone(&msg_var);
11663         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11664         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11665         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11666 }
11667 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
11668         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11669         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11670         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11671         LDKFundingSigned msg_var = *msg;
11672         uint64_t msg_ref = 0;
11673         msg_var = FundingSigned_clone(&msg_var);
11674         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11675         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11676         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11677 }
11678 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
11679         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11680         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11681         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11682         LDKChannelReady msg_var = *msg;
11683         uint64_t msg_ref = 0;
11684         msg_var = ChannelReady_clone(&msg_var);
11685         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11686         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11687         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11688 }
11689 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
11690         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11691         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11692         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11693         LDKShutdown msg_var = *msg;
11694         uint64_t msg_ref = 0;
11695         msg_var = Shutdown_clone(&msg_var);
11696         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11697         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11698         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11699 }
11700 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11701         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11702         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11703         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11704         LDKClosingSigned msg_var = *msg;
11705         uint64_t msg_ref = 0;
11706         msg_var = ClosingSigned_clone(&msg_var);
11707         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11708         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11709         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11710 }
11711 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
11712         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11713         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11714         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11715         LDKTxAddInput msg_var = *msg;
11716         uint64_t msg_ref = 0;
11717         msg_var = TxAddInput_clone(&msg_var);
11718         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11719         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11720         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11721 }
11722 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
11723         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11724         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11725         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11726         LDKTxAddOutput msg_var = *msg;
11727         uint64_t msg_ref = 0;
11728         msg_var = TxAddOutput_clone(&msg_var);
11729         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11730         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11731         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11732 }
11733 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
11734         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11735         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11736         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11737         LDKTxRemoveInput msg_var = *msg;
11738         uint64_t msg_ref = 0;
11739         msg_var = TxRemoveInput_clone(&msg_var);
11740         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11741         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11742         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11743 }
11744 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
11745         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11746         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11747         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11748         LDKTxRemoveOutput msg_var = *msg;
11749         uint64_t msg_ref = 0;
11750         msg_var = TxRemoveOutput_clone(&msg_var);
11751         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11752         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11753         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11754 }
11755 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
11756         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11757         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11758         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11759         LDKTxComplete msg_var = *msg;
11760         uint64_t msg_ref = 0;
11761         msg_var = TxComplete_clone(&msg_var);
11762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11763         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11764         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11765 }
11766 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
11767         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11768         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11769         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11770         LDKTxSignatures msg_var = *msg;
11771         uint64_t msg_ref = 0;
11772         msg_var = TxSignatures_clone(&msg_var);
11773         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11774         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11775         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11776 }
11777 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
11778         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11779         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11780         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11781         LDKTxInitRbf msg_var = *msg;
11782         uint64_t msg_ref = 0;
11783         msg_var = TxInitRbf_clone(&msg_var);
11784         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11785         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11786         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11787 }
11788 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
11789         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11790         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11791         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11792         LDKTxAckRbf msg_var = *msg;
11793         uint64_t msg_ref = 0;
11794         msg_var = TxAckRbf_clone(&msg_var);
11795         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11796         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11797         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11798 }
11799 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
11800         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11801         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11802         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11803         LDKTxAbort msg_var = *msg;
11804         uint64_t msg_ref = 0;
11805         msg_var = TxAbort_clone(&msg_var);
11806         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11807         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11808         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11809 }
11810 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11811         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11812         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11813         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11814         LDKUpdateAddHTLC msg_var = *msg;
11815         uint64_t msg_ref = 0;
11816         msg_var = UpdateAddHTLC_clone(&msg_var);
11817         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11818         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11819         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11820 }
11821 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11822         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11823         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11824         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11825         LDKUpdateFulfillHTLC msg_var = *msg;
11826         uint64_t msg_ref = 0;
11827         msg_var = UpdateFulfillHTLC_clone(&msg_var);
11828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11829         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11830         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11831 }
11832 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11833         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11834         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11835         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11836         LDKUpdateFailHTLC msg_var = *msg;
11837         uint64_t msg_ref = 0;
11838         msg_var = UpdateFailHTLC_clone(&msg_var);
11839         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11840         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11841         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11842 }
11843 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11844         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11845         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11846         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11847         LDKUpdateFailMalformedHTLC msg_var = *msg;
11848         uint64_t msg_ref = 0;
11849         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11850         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11851         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11852         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11853 }
11854 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11855         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11856         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11857         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11858         LDKCommitmentSigned msg_var = *msg;
11859         uint64_t msg_ref = 0;
11860         msg_var = CommitmentSigned_clone(&msg_var);
11861         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11862         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11863         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11864 }
11865 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
11866         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11867         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11868         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11869         LDKRevokeAndACK msg_var = *msg;
11870         uint64_t msg_ref = 0;
11871         msg_var = RevokeAndACK_clone(&msg_var);
11872         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11873         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11874         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11875 }
11876 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
11877         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11878         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11879         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11880         LDKUpdateFee msg_var = *msg;
11881         uint64_t msg_ref = 0;
11882         msg_var = UpdateFee_clone(&msg_var);
11883         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11884         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11885         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11886 }
11887 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
11888         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11889         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11890         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11891         LDKAnnouncementSignatures msg_var = *msg;
11892         uint64_t msg_ref = 0;
11893         msg_var = AnnouncementSignatures_clone(&msg_var);
11894         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11895         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11896         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11897 }
11898 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
11899         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11900         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11901         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11902         js_invoke_function_uuuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
11903 }
11904 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
11905         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11906         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11907         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11908         LDKInit msg_var = *msg;
11909         uint64_t msg_ref = 0;
11910         msg_var = Init_clone(&msg_var);
11911         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11912         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11913         jboolean inbound_conv = inbound;
11914         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
11915         void* ret_ptr = untag_ptr(ret);
11916         CHECK_ACCESS(ret_ptr);
11917         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
11918         FREE(untag_ptr(ret));
11919         return ret_conv;
11920 }
11921 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
11922         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11923         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11924         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11925         LDKChannelReestablish msg_var = *msg;
11926         uint64_t msg_ref = 0;
11927         msg_var = ChannelReestablish_clone(&msg_var);
11928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11929         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11930         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11931 }
11932 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
11933         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11934         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11935         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11936         LDKChannelUpdate msg_var = *msg;
11937         uint64_t msg_ref = 0;
11938         msg_var = ChannelUpdate_clone(&msg_var);
11939         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11940         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11941         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11942 }
11943 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
11944         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11945         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11946         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11947         LDKErrorMessage msg_var = *msg;
11948         uint64_t msg_ref = 0;
11949         msg_var = ErrorMessage_clone(&msg_var);
11950         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11951         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11952         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11953 }
11954 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
11955         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11956         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, 0, 0, 0, 0, 0, 0);
11957         LDKNodeFeatures ret_conv;
11958         ret_conv.inner = untag_ptr(ret);
11959         ret_conv.is_owned = ptr_is_owned(ret);
11960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11961         return ret_conv;
11962 }
11963 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
11964         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11965         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11966         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11967         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
11968         LDKInitFeatures ret_conv;
11969         ret_conv.inner = untag_ptr(ret);
11970         ret_conv.is_owned = ptr_is_owned(ret);
11971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11972         return ret_conv;
11973 }
11974 LDKCOption_CVec_ChainHashZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
11975         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11976         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, 0, 0, 0, 0, 0, 0);
11977         void* ret_ptr = untag_ptr(ret);
11978         CHECK_ACCESS(ret_ptr);
11979         LDKCOption_CVec_ChainHashZZ ret_conv = *(LDKCOption_CVec_ChainHashZZ*)(ret_ptr);
11980         FREE(untag_ptr(ret));
11981         return ret_conv;
11982 }
11983 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11984         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11985         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11986         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11987 }
11988 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
11989         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11990         atomic_init(&calls->refcnt, 1);
11991         calls->instance_ptr = o;
11992
11993         LDKChannelMessageHandler ret = {
11994                 .this_arg = (void*) calls,
11995                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11996                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
11997                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
11998                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
11999                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12000                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12001                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12002                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12003                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12004                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
12005                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
12006                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
12007                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
12008                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
12009                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
12010                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
12011                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
12012                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
12013                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12014                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12015                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12016                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12017                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12018                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12019                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12020                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12021                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12022                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12023                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12024                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12025                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12026                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
12027                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
12028                 .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall,
12029                 .free = LDKChannelMessageHandler_JCalls_free,
12030                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
12031         };
12032         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12033         return ret;
12034 }
12035 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
12036         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12037         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
12038         return tag_ptr(res_ptr, true);
12039 }
12040 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) {
12041         void* this_arg_ptr = untag_ptr(this_arg);
12042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12043         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12044         LDKPublicKey their_node_id_ref;
12045         CHECK(their_node_id->arr_len == 33);
12046         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12047         LDKOpenChannel msg_conv;
12048         msg_conv.inner = untag_ptr(msg);
12049         msg_conv.is_owned = ptr_is_owned(msg);
12050         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12051         msg_conv.is_owned = false;
12052         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12053 }
12054
12055 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) {
12056         void* this_arg_ptr = untag_ptr(this_arg);
12057         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12058         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12059         LDKPublicKey their_node_id_ref;
12060         CHECK(their_node_id->arr_len == 33);
12061         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12062         LDKOpenChannelV2 msg_conv;
12063         msg_conv.inner = untag_ptr(msg);
12064         msg_conv.is_owned = ptr_is_owned(msg);
12065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12066         msg_conv.is_owned = false;
12067         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12068 }
12069
12070 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) {
12071         void* this_arg_ptr = untag_ptr(this_arg);
12072         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12073         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12074         LDKPublicKey their_node_id_ref;
12075         CHECK(their_node_id->arr_len == 33);
12076         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12077         LDKAcceptChannel msg_conv;
12078         msg_conv.inner = untag_ptr(msg);
12079         msg_conv.is_owned = ptr_is_owned(msg);
12080         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12081         msg_conv.is_owned = false;
12082         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12083 }
12084
12085 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) {
12086         void* this_arg_ptr = untag_ptr(this_arg);
12087         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12088         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12089         LDKPublicKey their_node_id_ref;
12090         CHECK(their_node_id->arr_len == 33);
12091         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12092         LDKAcceptChannelV2 msg_conv;
12093         msg_conv.inner = untag_ptr(msg);
12094         msg_conv.is_owned = ptr_is_owned(msg);
12095         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12096         msg_conv.is_owned = false;
12097         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12098 }
12099
12100 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) {
12101         void* this_arg_ptr = untag_ptr(this_arg);
12102         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12103         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12104         LDKPublicKey their_node_id_ref;
12105         CHECK(their_node_id->arr_len == 33);
12106         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12107         LDKFundingCreated msg_conv;
12108         msg_conv.inner = untag_ptr(msg);
12109         msg_conv.is_owned = ptr_is_owned(msg);
12110         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12111         msg_conv.is_owned = false;
12112         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12113 }
12114
12115 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) {
12116         void* this_arg_ptr = untag_ptr(this_arg);
12117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12118         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12119         LDKPublicKey their_node_id_ref;
12120         CHECK(their_node_id->arr_len == 33);
12121         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12122         LDKFundingSigned msg_conv;
12123         msg_conv.inner = untag_ptr(msg);
12124         msg_conv.is_owned = ptr_is_owned(msg);
12125         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12126         msg_conv.is_owned = false;
12127         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12128 }
12129
12130 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) {
12131         void* this_arg_ptr = untag_ptr(this_arg);
12132         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12133         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12134         LDKPublicKey their_node_id_ref;
12135         CHECK(their_node_id->arr_len == 33);
12136         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12137         LDKChannelReady msg_conv;
12138         msg_conv.inner = untag_ptr(msg);
12139         msg_conv.is_owned = ptr_is_owned(msg);
12140         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12141         msg_conv.is_owned = false;
12142         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12143 }
12144
12145 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
12146         void* this_arg_ptr = untag_ptr(this_arg);
12147         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12148         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12149         LDKPublicKey their_node_id_ref;
12150         CHECK(their_node_id->arr_len == 33);
12151         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12152         LDKShutdown msg_conv;
12153         msg_conv.inner = untag_ptr(msg);
12154         msg_conv.is_owned = ptr_is_owned(msg);
12155         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12156         msg_conv.is_owned = false;
12157         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12158 }
12159
12160 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) {
12161         void* this_arg_ptr = untag_ptr(this_arg);
12162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12163         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12164         LDKPublicKey their_node_id_ref;
12165         CHECK(their_node_id->arr_len == 33);
12166         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12167         LDKClosingSigned msg_conv;
12168         msg_conv.inner = untag_ptr(msg);
12169         msg_conv.is_owned = ptr_is_owned(msg);
12170         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12171         msg_conv.is_owned = false;
12172         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12173 }
12174
12175 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) {
12176         void* this_arg_ptr = untag_ptr(this_arg);
12177         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12178         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12179         LDKPublicKey their_node_id_ref;
12180         CHECK(their_node_id->arr_len == 33);
12181         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12182         LDKTxAddInput msg_conv;
12183         msg_conv.inner = untag_ptr(msg);
12184         msg_conv.is_owned = ptr_is_owned(msg);
12185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12186         msg_conv.is_owned = false;
12187         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12188 }
12189
12190 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) {
12191         void* this_arg_ptr = untag_ptr(this_arg);
12192         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12193         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12194         LDKPublicKey their_node_id_ref;
12195         CHECK(their_node_id->arr_len == 33);
12196         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12197         LDKTxAddOutput msg_conv;
12198         msg_conv.inner = untag_ptr(msg);
12199         msg_conv.is_owned = ptr_is_owned(msg);
12200         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12201         msg_conv.is_owned = false;
12202         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12203 }
12204
12205 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) {
12206         void* this_arg_ptr = untag_ptr(this_arg);
12207         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12208         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12209         LDKPublicKey their_node_id_ref;
12210         CHECK(their_node_id->arr_len == 33);
12211         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12212         LDKTxRemoveInput msg_conv;
12213         msg_conv.inner = untag_ptr(msg);
12214         msg_conv.is_owned = ptr_is_owned(msg);
12215         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12216         msg_conv.is_owned = false;
12217         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12218 }
12219
12220 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) {
12221         void* this_arg_ptr = untag_ptr(this_arg);
12222         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12223         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12224         LDKPublicKey their_node_id_ref;
12225         CHECK(their_node_id->arr_len == 33);
12226         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12227         LDKTxRemoveOutput msg_conv;
12228         msg_conv.inner = untag_ptr(msg);
12229         msg_conv.is_owned = ptr_is_owned(msg);
12230         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12231         msg_conv.is_owned = false;
12232         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12233 }
12234
12235 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) {
12236         void* this_arg_ptr = untag_ptr(this_arg);
12237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12238         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12239         LDKPublicKey their_node_id_ref;
12240         CHECK(their_node_id->arr_len == 33);
12241         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12242         LDKTxComplete msg_conv;
12243         msg_conv.inner = untag_ptr(msg);
12244         msg_conv.is_owned = ptr_is_owned(msg);
12245         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12246         msg_conv.is_owned = false;
12247         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12248 }
12249
12250 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) {
12251         void* this_arg_ptr = untag_ptr(this_arg);
12252         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12253         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12254         LDKPublicKey their_node_id_ref;
12255         CHECK(their_node_id->arr_len == 33);
12256         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12257         LDKTxSignatures msg_conv;
12258         msg_conv.inner = untag_ptr(msg);
12259         msg_conv.is_owned = ptr_is_owned(msg);
12260         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12261         msg_conv.is_owned = false;
12262         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12263 }
12264
12265 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) {
12266         void* this_arg_ptr = untag_ptr(this_arg);
12267         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12268         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12269         LDKPublicKey their_node_id_ref;
12270         CHECK(their_node_id->arr_len == 33);
12271         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12272         LDKTxInitRbf msg_conv;
12273         msg_conv.inner = untag_ptr(msg);
12274         msg_conv.is_owned = ptr_is_owned(msg);
12275         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12276         msg_conv.is_owned = false;
12277         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12278 }
12279
12280 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) {
12281         void* this_arg_ptr = untag_ptr(this_arg);
12282         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12283         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12284         LDKPublicKey their_node_id_ref;
12285         CHECK(their_node_id->arr_len == 33);
12286         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12287         LDKTxAckRbf msg_conv;
12288         msg_conv.inner = untag_ptr(msg);
12289         msg_conv.is_owned = ptr_is_owned(msg);
12290         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12291         msg_conv.is_owned = false;
12292         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12293 }
12294
12295 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) {
12296         void* this_arg_ptr = untag_ptr(this_arg);
12297         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12298         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12299         LDKPublicKey their_node_id_ref;
12300         CHECK(their_node_id->arr_len == 33);
12301         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12302         LDKTxAbort msg_conv;
12303         msg_conv.inner = untag_ptr(msg);
12304         msg_conv.is_owned = ptr_is_owned(msg);
12305         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12306         msg_conv.is_owned = false;
12307         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12308 }
12309
12310 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) {
12311         void* this_arg_ptr = untag_ptr(this_arg);
12312         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12313         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12314         LDKPublicKey their_node_id_ref;
12315         CHECK(their_node_id->arr_len == 33);
12316         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12317         LDKUpdateAddHTLC msg_conv;
12318         msg_conv.inner = untag_ptr(msg);
12319         msg_conv.is_owned = ptr_is_owned(msg);
12320         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12321         msg_conv.is_owned = false;
12322         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12323 }
12324
12325 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) {
12326         void* this_arg_ptr = untag_ptr(this_arg);
12327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12328         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12329         LDKPublicKey their_node_id_ref;
12330         CHECK(their_node_id->arr_len == 33);
12331         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12332         LDKUpdateFulfillHTLC msg_conv;
12333         msg_conv.inner = untag_ptr(msg);
12334         msg_conv.is_owned = ptr_is_owned(msg);
12335         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12336         msg_conv.is_owned = false;
12337         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12338 }
12339
12340 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) {
12341         void* this_arg_ptr = untag_ptr(this_arg);
12342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12343         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12344         LDKPublicKey their_node_id_ref;
12345         CHECK(their_node_id->arr_len == 33);
12346         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12347         LDKUpdateFailHTLC msg_conv;
12348         msg_conv.inner = untag_ptr(msg);
12349         msg_conv.is_owned = ptr_is_owned(msg);
12350         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12351         msg_conv.is_owned = false;
12352         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12353 }
12354
12355 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) {
12356         void* this_arg_ptr = untag_ptr(this_arg);
12357         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12358         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12359         LDKPublicKey their_node_id_ref;
12360         CHECK(their_node_id->arr_len == 33);
12361         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12362         LDKUpdateFailMalformedHTLC msg_conv;
12363         msg_conv.inner = untag_ptr(msg);
12364         msg_conv.is_owned = ptr_is_owned(msg);
12365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12366         msg_conv.is_owned = false;
12367         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12368 }
12369
12370 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) {
12371         void* this_arg_ptr = untag_ptr(this_arg);
12372         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12373         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12374         LDKPublicKey their_node_id_ref;
12375         CHECK(their_node_id->arr_len == 33);
12376         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12377         LDKCommitmentSigned msg_conv;
12378         msg_conv.inner = untag_ptr(msg);
12379         msg_conv.is_owned = ptr_is_owned(msg);
12380         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12381         msg_conv.is_owned = false;
12382         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12383 }
12384
12385 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) {
12386         void* this_arg_ptr = untag_ptr(this_arg);
12387         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12388         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12389         LDKPublicKey their_node_id_ref;
12390         CHECK(their_node_id->arr_len == 33);
12391         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12392         LDKRevokeAndACK msg_conv;
12393         msg_conv.inner = untag_ptr(msg);
12394         msg_conv.is_owned = ptr_is_owned(msg);
12395         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12396         msg_conv.is_owned = false;
12397         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12398 }
12399
12400 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) {
12401         void* this_arg_ptr = untag_ptr(this_arg);
12402         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12403         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12404         LDKPublicKey their_node_id_ref;
12405         CHECK(their_node_id->arr_len == 33);
12406         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12407         LDKUpdateFee msg_conv;
12408         msg_conv.inner = untag_ptr(msg);
12409         msg_conv.is_owned = ptr_is_owned(msg);
12410         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12411         msg_conv.is_owned = false;
12412         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12413 }
12414
12415 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) {
12416         void* this_arg_ptr = untag_ptr(this_arg);
12417         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12418         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12419         LDKPublicKey their_node_id_ref;
12420         CHECK(their_node_id->arr_len == 33);
12421         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12422         LDKAnnouncementSignatures msg_conv;
12423         msg_conv.inner = untag_ptr(msg);
12424         msg_conv.is_owned = ptr_is_owned(msg);
12425         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12426         msg_conv.is_owned = false;
12427         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12428 }
12429
12430 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
12431         void* this_arg_ptr = untag_ptr(this_arg);
12432         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12433         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12434         LDKPublicKey their_node_id_ref;
12435         CHECK(their_node_id->arr_len == 33);
12436         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12437         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
12438 }
12439
12440 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) {
12441         void* this_arg_ptr = untag_ptr(this_arg);
12442         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12443         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12444         LDKPublicKey their_node_id_ref;
12445         CHECK(their_node_id->arr_len == 33);
12446         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12447         LDKInit msg_conv;
12448         msg_conv.inner = untag_ptr(msg);
12449         msg_conv.is_owned = ptr_is_owned(msg);
12450         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12451         msg_conv.is_owned = false;
12452         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12453         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
12454         return tag_ptr(ret_conv, true);
12455 }
12456
12457 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) {
12458         void* this_arg_ptr = untag_ptr(this_arg);
12459         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12460         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12461         LDKPublicKey their_node_id_ref;
12462         CHECK(their_node_id->arr_len == 33);
12463         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12464         LDKChannelReestablish msg_conv;
12465         msg_conv.inner = untag_ptr(msg);
12466         msg_conv.is_owned = ptr_is_owned(msg);
12467         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12468         msg_conv.is_owned = false;
12469         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12470 }
12471
12472 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) {
12473         void* this_arg_ptr = untag_ptr(this_arg);
12474         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12475         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12476         LDKPublicKey their_node_id_ref;
12477         CHECK(their_node_id->arr_len == 33);
12478         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12479         LDKChannelUpdate msg_conv;
12480         msg_conv.inner = untag_ptr(msg);
12481         msg_conv.is_owned = ptr_is_owned(msg);
12482         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12483         msg_conv.is_owned = false;
12484         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12485 }
12486
12487 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
12488         void* this_arg_ptr = untag_ptr(this_arg);
12489         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12490         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12491         LDKPublicKey their_node_id_ref;
12492         CHECK(their_node_id->arr_len == 33);
12493         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12494         LDKErrorMessage msg_conv;
12495         msg_conv.inner = untag_ptr(msg);
12496         msg_conv.is_owned = ptr_is_owned(msg);
12497         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12498         msg_conv.is_owned = false;
12499         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12500 }
12501
12502 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
12503         void* this_arg_ptr = untag_ptr(this_arg);
12504         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12505         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12506         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
12507         uint64_t ret_ref = 0;
12508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12510         return ret_ref;
12511 }
12512
12513 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
12514         void* this_arg_ptr = untag_ptr(this_arg);
12515         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12516         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12517         LDKPublicKey their_node_id_ref;
12518         CHECK(their_node_id->arr_len == 33);
12519         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12520         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
12521         uint64_t ret_ref = 0;
12522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12524         return ret_ref;
12525 }
12526
12527 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_genesis_hashes"))) TS_ChannelMessageHandler_get_genesis_hashes(uint64_t this_arg) {
12528         void* this_arg_ptr = untag_ptr(this_arg);
12529         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12530         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12531         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
12532         *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg);
12533         uint64_t ret_ref = tag_ptr(ret_copy, true);
12534         return ret_ref;
12535 }
12536
12537 typedef struct LDKRoutingMessageHandler_JCalls {
12538         atomic_size_t refcnt;
12539         uint32_t instance_ptr;
12540         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12541 } LDKRoutingMessageHandler_JCalls;
12542 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
12543         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12544         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12545                 FREE(j_calls);
12546         }
12547 }
12548 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
12549         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12550         LDKNodeAnnouncement msg_var = *msg;
12551         uint64_t msg_ref = 0;
12552         msg_var = NodeAnnouncement_clone(&msg_var);
12553         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12554         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12555         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 101, msg_ref, 0, 0, 0, 0, 0);
12556         void* ret_ptr = untag_ptr(ret);
12557         CHECK_ACCESS(ret_ptr);
12558         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12559         FREE(untag_ptr(ret));
12560         return ret_conv;
12561 }
12562 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
12563         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12564         LDKChannelAnnouncement msg_var = *msg;
12565         uint64_t msg_ref = 0;
12566         msg_var = ChannelAnnouncement_clone(&msg_var);
12567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12568         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12569         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 102, msg_ref, 0, 0, 0, 0, 0);
12570         void* ret_ptr = untag_ptr(ret);
12571         CHECK_ACCESS(ret_ptr);
12572         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12573         FREE(untag_ptr(ret));
12574         return ret_conv;
12575 }
12576 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
12577         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12578         LDKChannelUpdate msg_var = *msg;
12579         uint64_t msg_ref = 0;
12580         msg_var = ChannelUpdate_clone(&msg_var);
12581         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12582         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12583         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 103, msg_ref, 0, 0, 0, 0, 0);
12584         void* ret_ptr = untag_ptr(ret);
12585         CHECK_ACCESS(ret_ptr);
12586         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12587         FREE(untag_ptr(ret));
12588         return ret_conv;
12589 }
12590 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
12591         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12592         int64_t starting_point_conv = starting_point;
12593         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 104, starting_point_conv, 0, 0, 0, 0, 0);
12594         void* ret_ptr = untag_ptr(ret);
12595         CHECK_ACCESS(ret_ptr);
12596         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
12597         FREE(untag_ptr(ret));
12598         return ret_conv;
12599 }
12600 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
12601         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12602         LDKNodeId starting_point_var = starting_point;
12603         uint64_t starting_point_ref = 0;
12604         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
12605         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
12606         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 105, starting_point_ref, 0, 0, 0, 0, 0);
12607         LDKNodeAnnouncement ret_conv;
12608         ret_conv.inner = untag_ptr(ret);
12609         ret_conv.is_owned = ptr_is_owned(ret);
12610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12611         return ret_conv;
12612 }
12613 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
12614         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12615         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12616         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12617         LDKInit init_var = *init;
12618         uint64_t init_ref = 0;
12619         init_var = Init_clone(&init_var);
12620         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12621         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
12622         jboolean inbound_conv = inbound;
12623         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
12624         void* ret_ptr = untag_ptr(ret);
12625         CHECK_ACCESS(ret_ptr);
12626         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
12627         FREE(untag_ptr(ret));
12628         return ret_conv;
12629 }
12630 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12631         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12632         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12633         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12634         LDKReplyChannelRange msg_var = msg;
12635         uint64_t msg_ref = 0;
12636         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12637         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12638         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 107, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12639         void* ret_ptr = untag_ptr(ret);
12640         CHECK_ACCESS(ret_ptr);
12641         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12642         FREE(untag_ptr(ret));
12643         return ret_conv;
12644 }
12645 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12646         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12647         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12648         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12649         LDKReplyShortChannelIdsEnd msg_var = msg;
12650         uint64_t msg_ref = 0;
12651         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12652         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12653         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 108, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12654         void* ret_ptr = untag_ptr(ret);
12655         CHECK_ACCESS(ret_ptr);
12656         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12657         FREE(untag_ptr(ret));
12658         return ret_conv;
12659 }
12660 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12661         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12662         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12663         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12664         LDKQueryChannelRange msg_var = msg;
12665         uint64_t msg_ref = 0;
12666         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12667         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12668         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 109, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12669         void* ret_ptr = untag_ptr(ret);
12670         CHECK_ACCESS(ret_ptr);
12671         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12672         FREE(untag_ptr(ret));
12673         return ret_conv;
12674 }
12675 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12676         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12677         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12678         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12679         LDKQueryShortChannelIds msg_var = msg;
12680         uint64_t msg_ref = 0;
12681         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12682         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12683         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 110, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12684         void* ret_ptr = untag_ptr(ret);
12685         CHECK_ACCESS(ret_ptr);
12686         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12687         FREE(untag_ptr(ret));
12688         return ret_conv;
12689 }
12690 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
12691         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12692         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 111, 0, 0, 0, 0, 0, 0);
12693 }
12694 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
12695         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12696         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, 0, 0, 0, 0, 0, 0);
12697         LDKNodeFeatures ret_conv;
12698         ret_conv.inner = untag_ptr(ret);
12699         ret_conv.is_owned = ptr_is_owned(ret);
12700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12701         return ret_conv;
12702 }
12703 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12704         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12705         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12706         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12707         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
12708         LDKInitFeatures ret_conv;
12709         ret_conv.inner = untag_ptr(ret);
12710         ret_conv.is_owned = ptr_is_owned(ret);
12711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12712         return ret_conv;
12713 }
12714 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
12715         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
12716         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12717         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12718 }
12719 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
12720         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
12721         atomic_init(&calls->refcnt, 1);
12722         calls->instance_ptr = o;
12723
12724         LDKRoutingMessageHandler ret = {
12725                 .this_arg = (void*) calls,
12726                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
12727                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
12728                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
12729                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
12730                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
12731                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
12732                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
12733                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
12734                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
12735                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
12736                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
12737                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
12738                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
12739                 .free = LDKRoutingMessageHandler_JCalls_free,
12740                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
12741         };
12742         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12743         return ret;
12744 }
12745 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
12746         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12747         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
12748         return tag_ptr(res_ptr, true);
12749 }
12750 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
12751         void* this_arg_ptr = untag_ptr(this_arg);
12752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12753         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12754         LDKNodeAnnouncement msg_conv;
12755         msg_conv.inner = untag_ptr(msg);
12756         msg_conv.is_owned = ptr_is_owned(msg);
12757         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12758         msg_conv.is_owned = false;
12759         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12760         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
12761         return tag_ptr(ret_conv, true);
12762 }
12763
12764 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
12765         void* this_arg_ptr = untag_ptr(this_arg);
12766         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12767         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12768         LDKChannelAnnouncement msg_conv;
12769         msg_conv.inner = untag_ptr(msg);
12770         msg_conv.is_owned = ptr_is_owned(msg);
12771         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12772         msg_conv.is_owned = false;
12773         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12774         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
12775         return tag_ptr(ret_conv, true);
12776 }
12777
12778 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
12779         void* this_arg_ptr = untag_ptr(this_arg);
12780         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12781         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12782         LDKChannelUpdate msg_conv;
12783         msg_conv.inner = untag_ptr(msg);
12784         msg_conv.is_owned = ptr_is_owned(msg);
12785         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12786         msg_conv.is_owned = false;
12787         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12788         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
12789         return tag_ptr(ret_conv, true);
12790 }
12791
12792 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) {
12793         void* this_arg_ptr = untag_ptr(this_arg);
12794         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12795         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12796         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
12797         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
12798         uint64_t ret_ref = tag_ptr(ret_copy, true);
12799         return ret_ref;
12800 }
12801
12802 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) {
12803         void* this_arg_ptr = untag_ptr(this_arg);
12804         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12805         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12806         LDKNodeId starting_point_conv;
12807         starting_point_conv.inner = untag_ptr(starting_point);
12808         starting_point_conv.is_owned = ptr_is_owned(starting_point);
12809         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
12810         starting_point_conv = NodeId_clone(&starting_point_conv);
12811         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
12812         uint64_t ret_ref = 0;
12813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12815         return ret_ref;
12816 }
12817
12818 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) {
12819         void* this_arg_ptr = untag_ptr(this_arg);
12820         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12821         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12822         LDKPublicKey their_node_id_ref;
12823         CHECK(their_node_id->arr_len == 33);
12824         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12825         LDKInit init_conv;
12826         init_conv.inner = untag_ptr(init);
12827         init_conv.is_owned = ptr_is_owned(init);
12828         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12829         init_conv.is_owned = false;
12830         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12831         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
12832         return tag_ptr(ret_conv, true);
12833 }
12834
12835 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) {
12836         void* this_arg_ptr = untag_ptr(this_arg);
12837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12838         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12839         LDKPublicKey their_node_id_ref;
12840         CHECK(their_node_id->arr_len == 33);
12841         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12842         LDKReplyChannelRange msg_conv;
12843         msg_conv.inner = untag_ptr(msg);
12844         msg_conv.is_owned = ptr_is_owned(msg);
12845         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12846         msg_conv = ReplyChannelRange_clone(&msg_conv);
12847         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12848         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12849         return tag_ptr(ret_conv, true);
12850 }
12851
12852 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) {
12853         void* this_arg_ptr = untag_ptr(this_arg);
12854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12855         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12856         LDKPublicKey their_node_id_ref;
12857         CHECK(their_node_id->arr_len == 33);
12858         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12859         LDKReplyShortChannelIdsEnd msg_conv;
12860         msg_conv.inner = untag_ptr(msg);
12861         msg_conv.is_owned = ptr_is_owned(msg);
12862         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12863         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12864         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12865         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12866         return tag_ptr(ret_conv, true);
12867 }
12868
12869 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) {
12870         void* this_arg_ptr = untag_ptr(this_arg);
12871         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12872         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12873         LDKPublicKey their_node_id_ref;
12874         CHECK(their_node_id->arr_len == 33);
12875         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12876         LDKQueryChannelRange msg_conv;
12877         msg_conv.inner = untag_ptr(msg);
12878         msg_conv.is_owned = ptr_is_owned(msg);
12879         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12880         msg_conv = QueryChannelRange_clone(&msg_conv);
12881         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12882         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12883         return tag_ptr(ret_conv, true);
12884 }
12885
12886 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) {
12887         void* this_arg_ptr = untag_ptr(this_arg);
12888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12889         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12890         LDKPublicKey their_node_id_ref;
12891         CHECK(their_node_id->arr_len == 33);
12892         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12893         LDKQueryShortChannelIds msg_conv;
12894         msg_conv.inner = untag_ptr(msg);
12895         msg_conv.is_owned = ptr_is_owned(msg);
12896         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12897         msg_conv = QueryShortChannelIds_clone(&msg_conv);
12898         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12899         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12900         return tag_ptr(ret_conv, true);
12901 }
12902
12903 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
12904         void* this_arg_ptr = untag_ptr(this_arg);
12905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12906         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12907         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
12908         return ret_conv;
12909 }
12910
12911 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
12912         void* this_arg_ptr = untag_ptr(this_arg);
12913         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12914         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12915         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
12916         uint64_t ret_ref = 0;
12917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12919         return ret_ref;
12920 }
12921
12922 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
12923         void* this_arg_ptr = untag_ptr(this_arg);
12924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12925         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12926         LDKPublicKey their_node_id_ref;
12927         CHECK(their_node_id->arr_len == 33);
12928         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12929         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
12930         uint64_t ret_ref = 0;
12931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12933         return ret_ref;
12934 }
12935
12936 typedef struct LDKOnionMessageProvider_JCalls {
12937         atomic_size_t refcnt;
12938         uint32_t instance_ptr;
12939 } LDKOnionMessageProvider_JCalls;
12940 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
12941         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
12942         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12943                 FREE(j_calls);
12944         }
12945 }
12946 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
12947         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
12948         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
12949         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
12950         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
12951         LDKOnionMessage ret_conv;
12952         ret_conv.inner = untag_ptr(ret);
12953         ret_conv.is_owned = ptr_is_owned(ret);
12954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12955         return ret_conv;
12956 }
12957 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
12958         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
12959         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12960 }
12961 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
12962         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
12963         atomic_init(&calls->refcnt, 1);
12964         calls->instance_ptr = o;
12965
12966         LDKOnionMessageProvider ret = {
12967                 .this_arg = (void*) calls,
12968                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
12969                 .free = LDKOnionMessageProvider_JCalls_free,
12970         };
12971         return ret;
12972 }
12973 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
12974         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
12975         *res_ptr = LDKOnionMessageProvider_init(o);
12976         return tag_ptr(res_ptr, true);
12977 }
12978 uint64_t  __attribute__((export_name("TS_OnionMessageProvider_next_onion_message_for_peer"))) TS_OnionMessageProvider_next_onion_message_for_peer(uint64_t this_arg, int8_tArray peer_node_id) {
12979         void* this_arg_ptr = untag_ptr(this_arg);
12980         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12981         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
12982         LDKPublicKey peer_node_id_ref;
12983         CHECK(peer_node_id->arr_len == 33);
12984         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
12985         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
12986         uint64_t ret_ref = 0;
12987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12989         return ret_ref;
12990 }
12991
12992 typedef struct LDKOnionMessageHandler_JCalls {
12993         atomic_size_t refcnt;
12994         uint32_t instance_ptr;
12995         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
12996 } LDKOnionMessageHandler_JCalls;
12997 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
12998         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
12999         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13000                 FREE(j_calls);
13001         }
13002 }
13003 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
13004         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13005         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
13006         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
13007         LDKOnionMessage msg_var = *msg;
13008         uint64_t msg_ref = 0;
13009         msg_var = OnionMessage_clone(&msg_var);
13010         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13011         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13012         js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
13013 }
13014 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
13015         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13016         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13017         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13018         LDKInit init_var = *init;
13019         uint64_t init_ref = 0;
13020         init_var = Init_clone(&init_var);
13021         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13022         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13023         jboolean inbound_conv = inbound;
13024         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 116, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
13025         void* ret_ptr = untag_ptr(ret);
13026         CHECK_ACCESS(ret_ptr);
13027         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13028         FREE(untag_ptr(ret));
13029         return ret_conv;
13030 }
13031 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13032         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13033         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13034         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13035         js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13036 }
13037 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
13038         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13039         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 118, 0, 0, 0, 0, 0, 0);
13040         LDKNodeFeatures ret_conv;
13041         ret_conv.inner = untag_ptr(ret);
13042         ret_conv.is_owned = ptr_is_owned(ret);
13043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13044         return ret_conv;
13045 }
13046 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13047         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13048         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13049         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13050         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13051         LDKInitFeatures ret_conv;
13052         ret_conv.inner = untag_ptr(ret);
13053         ret_conv.is_owned = ptr_is_owned(ret);
13054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13055         return ret_conv;
13056 }
13057 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
13058         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
13059         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13060         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
13061 }
13062 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
13063         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
13064         atomic_init(&calls->refcnt, 1);
13065         calls->instance_ptr = o;
13066
13067         LDKOnionMessageHandler ret = {
13068                 .this_arg = (void*) calls,
13069                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
13070                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
13071                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
13072                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
13073                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
13074                 .free = LDKOnionMessageHandler_JCalls_free,
13075                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
13076         };
13077         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
13078         return ret;
13079 }
13080 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
13081         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
13082         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
13083         return tag_ptr(res_ptr, true);
13084 }
13085 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) {
13086         void* this_arg_ptr = untag_ptr(this_arg);
13087         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13088         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13089         LDKPublicKey peer_node_id_ref;
13090         CHECK(peer_node_id->arr_len == 33);
13091         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
13092         LDKOnionMessage msg_conv;
13093         msg_conv.inner = untag_ptr(msg);
13094         msg_conv.is_owned = ptr_is_owned(msg);
13095         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13096         msg_conv.is_owned = false;
13097         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
13098 }
13099
13100 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) {
13101         void* this_arg_ptr = untag_ptr(this_arg);
13102         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13103         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13104         LDKPublicKey their_node_id_ref;
13105         CHECK(their_node_id->arr_len == 33);
13106         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13107         LDKInit init_conv;
13108         init_conv.inner = untag_ptr(init);
13109         init_conv.is_owned = ptr_is_owned(init);
13110         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13111         init_conv.is_owned = false;
13112         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13113         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
13114         return tag_ptr(ret_conv, true);
13115 }
13116
13117 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
13118         void* this_arg_ptr = untag_ptr(this_arg);
13119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13120         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13121         LDKPublicKey their_node_id_ref;
13122         CHECK(their_node_id->arr_len == 33);
13123         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13124         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13125 }
13126
13127 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
13128         void* this_arg_ptr = untag_ptr(this_arg);
13129         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13130         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13131         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13132         uint64_t ret_ref = 0;
13133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13135         return ret_ref;
13136 }
13137
13138 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13139         void* this_arg_ptr = untag_ptr(this_arg);
13140         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13141         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13142         LDKPublicKey their_node_id_ref;
13143         CHECK(their_node_id->arr_len == 33);
13144         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13145         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13146         uint64_t ret_ref = 0;
13147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13149         return ret_ref;
13150 }
13151
13152 typedef struct LDKCustomMessageReader_JCalls {
13153         atomic_size_t refcnt;
13154         uint32_t instance_ptr;
13155 } LDKCustomMessageReader_JCalls;
13156 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13157         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13158         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13159                 FREE(j_calls);
13160         }
13161 }
13162 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13163         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13164         int16_t message_type_conv = message_type;
13165         LDKu8slice buffer_var = buffer;
13166         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
13167         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
13168         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
13169         void* ret_ptr = untag_ptr(ret);
13170         CHECK_ACCESS(ret_ptr);
13171         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13172         FREE(untag_ptr(ret));
13173         return ret_conv;
13174 }
13175 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13176         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13177         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13178 }
13179 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
13180         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13181         atomic_init(&calls->refcnt, 1);
13182         calls->instance_ptr = o;
13183
13184         LDKCustomMessageReader ret = {
13185                 .this_arg = (void*) calls,
13186                 .read = read_LDKCustomMessageReader_jcall,
13187                 .free = LDKCustomMessageReader_JCalls_free,
13188         };
13189         return ret;
13190 }
13191 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
13192         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13193         *res_ptr = LDKCustomMessageReader_init(o);
13194         return tag_ptr(res_ptr, true);
13195 }
13196 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
13197         void* this_arg_ptr = untag_ptr(this_arg);
13198         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13199         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
13200         LDKu8slice buffer_ref;
13201         buffer_ref.datalen = buffer->arr_len;
13202         buffer_ref.data = buffer->elems;
13203         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
13204         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
13205         FREE(buffer);
13206         return tag_ptr(ret_conv, true);
13207 }
13208
13209 typedef struct LDKCustomMessageHandler_JCalls {
13210         atomic_size_t refcnt;
13211         uint32_t instance_ptr;
13212         LDKCustomMessageReader_JCalls* CustomMessageReader;
13213 } LDKCustomMessageHandler_JCalls;
13214 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
13215         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13216         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13217                 FREE(j_calls);
13218         }
13219 }
13220 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
13221         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13222         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
13223         *msg_ret = msg;
13224         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
13225         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
13226         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
13227         void* ret_ptr = untag_ptr(ret);
13228         CHECK_ACCESS(ret_ptr);
13229         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13230         FREE(untag_ptr(ret));
13231         return ret_conv;
13232 }
13233 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
13234         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13235         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 122, 0, 0, 0, 0, 0, 0);
13236         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
13237         ret_constr.datalen = ret->arr_len;
13238         if (ret_constr.datalen > 0)
13239                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13240         else
13241                 ret_constr.data = NULL;
13242         uint64_t* ret_vals = ret->elems;
13243         for (size_t z = 0; z < ret_constr.datalen; z++) {
13244                 uint64_t ret_conv_25 = ret_vals[z];
13245                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
13246                 CHECK_ACCESS(ret_conv_25_ptr);
13247                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
13248                 FREE(untag_ptr(ret_conv_25));
13249                 ret_constr.data[z] = ret_conv_25_conv;
13250         }
13251         FREE(ret);
13252         return ret_constr;
13253 }
13254 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
13255         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13256         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 123, 0, 0, 0, 0, 0, 0);
13257         LDKNodeFeatures ret_conv;
13258         ret_conv.inner = untag_ptr(ret);
13259         ret_conv.is_owned = ptr_is_owned(ret);
13260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13261         return ret_conv;
13262 }
13263 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13264         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13265         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13266         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13267         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 124, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13268         LDKInitFeatures ret_conv;
13269         ret_conv.inner = untag_ptr(ret);
13270         ret_conv.is_owned = ptr_is_owned(ret);
13271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13272         return ret_conv;
13273 }
13274 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
13275         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
13276         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13277         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
13278 }
13279 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
13280         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
13281         atomic_init(&calls->refcnt, 1);
13282         calls->instance_ptr = o;
13283
13284         LDKCustomMessageHandler ret = {
13285                 .this_arg = (void*) calls,
13286                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
13287                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
13288                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
13289                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
13290                 .free = LDKCustomMessageHandler_JCalls_free,
13291                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
13292         };
13293         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
13294         return ret;
13295 }
13296 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
13297         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
13298         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
13299         return tag_ptr(res_ptr, true);
13300 }
13301 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) {
13302         void* this_arg_ptr = untag_ptr(this_arg);
13303         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13304         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13305         void* msg_ptr = untag_ptr(msg);
13306         CHECK_ACCESS(msg_ptr);
13307         LDKType msg_conv = *(LDKType*)(msg_ptr);
13308         if (msg_conv.free == LDKType_JCalls_free) {
13309                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13310                 LDKType_JCalls_cloned(&msg_conv);
13311         }
13312         LDKPublicKey sender_node_id_ref;
13313         CHECK(sender_node_id->arr_len == 33);
13314         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
13315         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13316         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
13317         return tag_ptr(ret_conv, true);
13318 }
13319
13320 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
13321         void* this_arg_ptr = untag_ptr(this_arg);
13322         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13323         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13324         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
13325         uint64_tArray ret_arr = NULL;
13326         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13327         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13328         for (size_t z = 0; z < ret_var.datalen; z++) {
13329                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13330                 *ret_conv_25_conv = ret_var.data[z];
13331                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
13332         }
13333         
13334         FREE(ret_var.data);
13335         return ret_arr;
13336 }
13337
13338 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
13339         void* this_arg_ptr = untag_ptr(this_arg);
13340         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13341         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13342         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13343         uint64_t ret_ref = 0;
13344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13346         return ret_ref;
13347 }
13348
13349 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13350         void* this_arg_ptr = untag_ptr(this_arg);
13351         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13352         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13353         LDKPublicKey their_node_id_ref;
13354         CHECK(their_node_id->arr_len == 33);
13355         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13356         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13357         uint64_t ret_ref = 0;
13358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13360         return ret_ref;
13361 }
13362
13363 typedef struct LDKOffersMessageHandler_JCalls {
13364         atomic_size_t refcnt;
13365         uint32_t instance_ptr;
13366 } LDKOffersMessageHandler_JCalls;
13367 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
13368         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13369         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13370                 FREE(j_calls);
13371         }
13372 }
13373 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
13374         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13375         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
13376         *message_copy = message;
13377         uint64_t message_ref = tag_ptr(message_copy, true);
13378         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 125, message_ref, 0, 0, 0, 0, 0);
13379         void* ret_ptr = untag_ptr(ret);
13380         CHECK_ACCESS(ret_ptr);
13381         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
13382         FREE(untag_ptr(ret));
13383         return ret_conv;
13384 }
13385 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
13386         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
13387         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13388 }
13389 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
13390         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
13391         atomic_init(&calls->refcnt, 1);
13392         calls->instance_ptr = o;
13393
13394         LDKOffersMessageHandler ret = {
13395                 .this_arg = (void*) calls,
13396                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
13397                 .free = LDKOffersMessageHandler_JCalls_free,
13398         };
13399         return ret;
13400 }
13401 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
13402         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
13403         *res_ptr = LDKOffersMessageHandler_init(o);
13404         return tag_ptr(res_ptr, true);
13405 }
13406 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
13407         void* this_arg_ptr = untag_ptr(this_arg);
13408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13409         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
13410         void* message_ptr = untag_ptr(message);
13411         CHECK_ACCESS(message_ptr);
13412         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
13413         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
13414         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
13415         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
13416         uint64_t ret_ref = tag_ptr(ret_copy, true);
13417         return ret_ref;
13418 }
13419
13420 typedef struct LDKCustomOnionMessageHandler_JCalls {
13421         atomic_size_t refcnt;
13422         uint32_t instance_ptr;
13423 } LDKCustomOnionMessageHandler_JCalls;
13424 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
13425         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
13426         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13427                 FREE(j_calls);
13428         }
13429 }
13430 LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
13431         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
13432         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
13433         *msg_ret = msg;
13434         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 126, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
13435         void* ret_ptr = untag_ptr(ret);
13436         CHECK_ACCESS(ret_ptr);
13437         LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr);
13438         FREE(untag_ptr(ret));
13439         return ret_conv;
13440 }
13441 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
13442         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
13443         int64_t message_type_conv = message_type;
13444         LDKu8slice buffer_var = buffer;
13445         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
13446         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
13447         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 127, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
13448         void* ret_ptr = untag_ptr(ret);
13449         CHECK_ACCESS(ret_ptr);
13450         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
13451         FREE(untag_ptr(ret));
13452         return ret_conv;
13453 }
13454 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
13455         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
13456         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13457 }
13458 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
13459         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
13460         atomic_init(&calls->refcnt, 1);
13461         calls->instance_ptr = o;
13462
13463         LDKCustomOnionMessageHandler ret = {
13464                 .this_arg = (void*) calls,
13465                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
13466                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
13467                 .free = LDKCustomOnionMessageHandler_JCalls_free,
13468         };
13469         return ret;
13470 }
13471 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
13472         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
13473         *res_ptr = LDKCustomOnionMessageHandler_init(o);
13474         return tag_ptr(res_ptr, true);
13475 }
13476 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
13477         void* this_arg_ptr = untag_ptr(this_arg);
13478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13479         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
13480         void* msg_ptr = untag_ptr(msg);
13481         CHECK_ACCESS(msg_ptr);
13482         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
13483         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
13484                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13485                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
13486         }
13487         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
13488         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
13489         uint64_t ret_ref = tag_ptr(ret_copy, true);
13490         return ret_ref;
13491 }
13492
13493 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) {
13494         void* this_arg_ptr = untag_ptr(this_arg);
13495         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13496         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
13497         LDKu8slice buffer_ref;
13498         buffer_ref.datalen = buffer->arr_len;
13499         buffer_ref.data = buffer->elems;
13500         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
13501         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
13502         FREE(buffer);
13503         return tag_ptr(ret_conv, true);
13504 }
13505
13506 typedef struct LDKSocketDescriptor_JCalls {
13507         atomic_size_t refcnt;
13508         uint32_t instance_ptr;
13509 } LDKSocketDescriptor_JCalls;
13510 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
13511         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13512         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13513                 FREE(j_calls);
13514         }
13515 }
13516 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
13517         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13518         LDKu8slice data_var = data;
13519         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
13520         memcpy(data_arr->elems, data_var.data, data_var.datalen);
13521         jboolean resume_read_conv = resume_read;
13522         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 128, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
13523 }
13524 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
13525         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13526         js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
13527 }
13528 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
13529         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13530         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13531         *other_arg_clone = SocketDescriptor_clone(other_arg);
13532         return js_invoke_function_buuuuu(j_calls->instance_ptr, 130, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
13533 }
13534 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
13535         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13536         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, 0, 0, 0, 0, 0, 0);
13537 }
13538 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
13539         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
13540         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13541 }
13542 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
13543         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
13544         atomic_init(&calls->refcnt, 1);
13545         calls->instance_ptr = o;
13546
13547         LDKSocketDescriptor ret = {
13548                 .this_arg = (void*) calls,
13549                 .send_data = send_data_LDKSocketDescriptor_jcall,
13550                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
13551                 .eq = eq_LDKSocketDescriptor_jcall,
13552                 .hash = hash_LDKSocketDescriptor_jcall,
13553                 .cloned = LDKSocketDescriptor_JCalls_cloned,
13554                 .free = LDKSocketDescriptor_JCalls_free,
13555         };
13556         return ret;
13557 }
13558 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
13559         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13560         *res_ptr = LDKSocketDescriptor_init(o);
13561         return tag_ptr(res_ptr, true);
13562 }
13563 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
13564         void* this_arg_ptr = untag_ptr(this_arg);
13565         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13566         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13567         LDKu8slice data_ref;
13568         data_ref.datalen = data->arr_len;
13569         data_ref.data = data->elems;
13570         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
13571         FREE(data);
13572         return ret_conv;
13573 }
13574
13575 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
13576         void* this_arg_ptr = untag_ptr(this_arg);
13577         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13578         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13579         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
13580 }
13581
13582 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
13583         void* this_arg_ptr = untag_ptr(this_arg);
13584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13585         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13586         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
13587         return ret_conv;
13588 }
13589
13590 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
13591         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13592         switch(obj->tag) {
13593                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
13594                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
13595                 case LDKEffectiveCapacity_Total: return 2;
13596                 case LDKEffectiveCapacity_Infinite: return 3;
13597                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
13598                 case LDKEffectiveCapacity_Unknown: return 5;
13599                 default: abort();
13600         }
13601 }
13602 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
13603         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13604         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
13605                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
13606         return liquidity_msat_conv;
13607 }
13608 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
13609         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13610         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
13611                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
13612         return amount_msat_conv;
13613 }
13614 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
13615         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13616         assert(obj->tag == LDKEffectiveCapacity_Total);
13617                         int64_t capacity_msat_conv = obj->total.capacity_msat;
13618         return capacity_msat_conv;
13619 }
13620 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
13621         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13622         assert(obj->tag == LDKEffectiveCapacity_Total);
13623                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
13624         return htlc_maximum_msat_conv;
13625 }
13626 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
13627         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13628         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
13629                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
13630         return amount_msat_conv;
13631 }
13632 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
13633         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13634         switch(obj->tag) {
13635                 case LDKPayee_Blinded: return 0;
13636                 case LDKPayee_Clear: return 1;
13637                 default: abort();
13638         }
13639 }
13640 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
13641         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13642         assert(obj->tag == LDKPayee_Blinded);
13643                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
13644                         uint64_tArray route_hints_arr = NULL;
13645                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
13646                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
13647                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
13648                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13649                                 *route_hints_conv_37_conv = route_hints_var.data[l];
13650                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
13651                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
13652                         }
13653                         
13654         return route_hints_arr;
13655 }
13656 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
13657         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13658         assert(obj->tag == LDKPayee_Blinded);
13659                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
13660                         uint64_t features_ref = 0;
13661                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
13662                         features_ref = tag_ptr(features_var.inner, false);
13663         return features_ref;
13664 }
13665 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
13666         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13667         assert(obj->tag == LDKPayee_Clear);
13668                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
13669                         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
13670         return node_id_arr;
13671 }
13672 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
13673         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13674         assert(obj->tag == LDKPayee_Clear);
13675                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
13676                         uint64_tArray route_hints_arr = NULL;
13677                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
13678                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
13679                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
13680                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
13681                                 uint64_t route_hints_conv_11_ref = 0;
13682                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
13683                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
13684                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
13685                         }
13686                         
13687         return route_hints_arr;
13688 }
13689 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
13690         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13691         assert(obj->tag == LDKPayee_Clear);
13692                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
13693                         uint64_t features_ref = 0;
13694                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
13695                         features_ref = tag_ptr(features_var.inner, false);
13696         return features_ref;
13697 }
13698 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
13699         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13700         assert(obj->tag == LDKPayee_Clear);
13701                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
13702         return final_cltv_expiry_delta_conv;
13703 }
13704 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
13705         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
13706         switch(obj->tag) {
13707                 case LDKDestination_Node: return 0;
13708                 case LDKDestination_BlindedPath: return 1;
13709                 default: abort();
13710         }
13711 }
13712 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
13713         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
13714         assert(obj->tag == LDKDestination_Node);
13715                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
13716                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
13717         return node_arr;
13718 }
13719 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
13720         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
13721         assert(obj->tag == LDKDestination_BlindedPath);
13722                         LDKBlindedPath blinded_path_var = obj->blinded_path;
13723                         uint64_t blinded_path_ref = 0;
13724                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
13725                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
13726         return blinded_path_ref;
13727 }
13728 typedef struct LDKMessageRouter_JCalls {
13729         atomic_size_t refcnt;
13730         uint32_t instance_ptr;
13731 } LDKMessageRouter_JCalls;
13732 static void LDKMessageRouter_JCalls_free(void* this_arg) {
13733         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
13734         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13735                 FREE(j_calls);
13736         }
13737 }
13738 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
13739         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
13740         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
13741         memcpy(sender_arr->elems, sender.compressed_form, 33);
13742         LDKCVec_PublicKeyZ peers_var = peers;
13743         ptrArray peers_arr = NULL;
13744         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
13745         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
13746         for (size_t m = 0; m < peers_var.datalen; m++) {
13747                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
13748                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
13749                 peers_arr_ptr[m] = peers_conv_12_arr;
13750         }
13751         
13752         FREE(peers_var.data);
13753         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
13754         *destination_copy = destination;
13755         uint64_t destination_ref = tag_ptr(destination_copy, true);
13756         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 132, (uint32_t)sender_arr, (uint32_t)peers_arr, destination_ref, 0, 0, 0);
13757         void* ret_ptr = untag_ptr(ret);
13758         CHECK_ACCESS(ret_ptr);
13759         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
13760         FREE(untag_ptr(ret));
13761         return ret_conv;
13762 }
13763 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
13764         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
13765         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13766 }
13767 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
13768         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
13769         atomic_init(&calls->refcnt, 1);
13770         calls->instance_ptr = o;
13771
13772         LDKMessageRouter ret = {
13773                 .this_arg = (void*) calls,
13774                 .find_path = find_path_LDKMessageRouter_jcall,
13775                 .free = LDKMessageRouter_JCalls_free,
13776         };
13777         return ret;
13778 }
13779 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
13780         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
13781         *res_ptr = LDKMessageRouter_init(o);
13782         return tag_ptr(res_ptr, true);
13783 }
13784 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) {
13785         void* this_arg_ptr = untag_ptr(this_arg);
13786         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13787         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
13788         LDKPublicKey sender_ref;
13789         CHECK(sender->arr_len == 33);
13790         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
13791         LDKCVec_PublicKeyZ peers_constr;
13792         peers_constr.datalen = peers->arr_len;
13793         if (peers_constr.datalen > 0)
13794                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13795         else
13796                 peers_constr.data = NULL;
13797         int8_tArray* peers_vals = (void*) peers->elems;
13798         for (size_t m = 0; m < peers_constr.datalen; m++) {
13799                 int8_tArray peers_conv_12 = peers_vals[m];
13800                 LDKPublicKey peers_conv_12_ref;
13801                 CHECK(peers_conv_12->arr_len == 33);
13802                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
13803                 peers_constr.data[m] = peers_conv_12_ref;
13804         }
13805         FREE(peers);
13806         void* destination_ptr = untag_ptr(destination);
13807         CHECK_ACCESS(destination_ptr);
13808         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
13809         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
13810         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
13811         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
13812         return tag_ptr(ret_conv, true);
13813 }
13814
13815 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
13816         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
13817         switch(obj->tag) {
13818                 case LDKOnionMessageContents_Offers: return 0;
13819                 case LDKOnionMessageContents_Custom: return 1;
13820                 default: abort();
13821         }
13822 }
13823 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Offers_get_offers"))) TS_LDKOnionMessageContents_Offers_get_offers(uint64_t ptr) {
13824         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
13825         assert(obj->tag == LDKOnionMessageContents_Offers);
13826                         uint64_t offers_ref = tag_ptr(&obj->offers, false);
13827         return offers_ref;
13828 }
13829 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
13830         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
13831         assert(obj->tag == LDKOnionMessageContents_Custom);
13832                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
13833                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
13834         return tag_ptr(custom_ret, true);
13835 }
13836 typedef struct LDKCoinSelectionSource_JCalls {
13837         atomic_size_t refcnt;
13838         uint32_t instance_ptr;
13839 } LDKCoinSelectionSource_JCalls;
13840 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
13841         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
13842         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13843                 FREE(j_calls);
13844         }
13845 }
13846 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) {
13847         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
13848         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
13849         memcpy(claim_id_arr->elems, claim_id.data, 32);
13850         LDKCVec_InputZ must_spend_var = must_spend;
13851         uint64_tArray must_spend_arr = NULL;
13852         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
13853         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
13854         for (size_t h = 0; h < must_spend_var.datalen; h++) {
13855                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
13856                 uint64_t must_spend_conv_7_ref = 0;
13857                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
13858                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
13859                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
13860         }
13861         
13862         FREE(must_spend_var.data);
13863         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
13864         uint64_tArray must_pay_to_arr = NULL;
13865         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
13866         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
13867         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
13868                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13869                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
13870                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
13871         }
13872         
13873         FREE(must_pay_to_var.data);
13874         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
13875         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 133, (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);
13876         void* ret_ptr = untag_ptr(ret);
13877         CHECK_ACCESS(ret_ptr);
13878         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
13879         FREE(untag_ptr(ret));
13880         return ret_conv;
13881 }
13882 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
13883         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
13884         LDKTransaction tx_var = tx;
13885         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
13886         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
13887         Transaction_free(tx_var);
13888         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 134, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
13889         void* ret_ptr = untag_ptr(ret);
13890         CHECK_ACCESS(ret_ptr);
13891         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
13892         FREE(untag_ptr(ret));
13893         return ret_conv;
13894 }
13895 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
13896         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
13897         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13898 }
13899 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
13900         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
13901         atomic_init(&calls->refcnt, 1);
13902         calls->instance_ptr = o;
13903
13904         LDKCoinSelectionSource ret = {
13905                 .this_arg = (void*) calls,
13906                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
13907                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
13908                 .free = LDKCoinSelectionSource_JCalls_free,
13909         };
13910         return ret;
13911 }
13912 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
13913         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
13914         *res_ptr = LDKCoinSelectionSource_init(o);
13915         return tag_ptr(res_ptr, true);
13916 }
13917 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) {
13918         void* this_arg_ptr = untag_ptr(this_arg);
13919         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13920         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
13921         LDKThirtyTwoBytes claim_id_ref;
13922         CHECK(claim_id->arr_len == 32);
13923         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
13924         LDKCVec_InputZ must_spend_constr;
13925         must_spend_constr.datalen = must_spend->arr_len;
13926         if (must_spend_constr.datalen > 0)
13927                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
13928         else
13929                 must_spend_constr.data = NULL;
13930         uint64_t* must_spend_vals = must_spend->elems;
13931         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
13932                 uint64_t must_spend_conv_7 = must_spend_vals[h];
13933                 LDKInput must_spend_conv_7_conv;
13934                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
13935                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
13936                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
13937                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
13938                 must_spend_constr.data[h] = must_spend_conv_7_conv;
13939         }
13940         FREE(must_spend);
13941         LDKCVec_TxOutZ must_pay_to_constr;
13942         must_pay_to_constr.datalen = must_pay_to->arr_len;
13943         if (must_pay_to_constr.datalen > 0)
13944                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13945         else
13946                 must_pay_to_constr.data = NULL;
13947         uint64_t* must_pay_to_vals = must_pay_to->elems;
13948         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
13949                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
13950                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
13951                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
13952                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
13953                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
13954                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
13955         }
13956         FREE(must_pay_to);
13957         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
13958         *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);
13959         return tag_ptr(ret_conv, true);
13960 }
13961
13962 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_tx"))) TS_CoinSelectionSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
13963         void* this_arg_ptr = untag_ptr(this_arg);
13964         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13965         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
13966         LDKTransaction tx_ref;
13967         tx_ref.datalen = tx->arr_len;
13968         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
13969         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
13970         tx_ref.data_is_owned = true;
13971         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13972         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
13973         return tag_ptr(ret_conv, true);
13974 }
13975
13976 typedef struct LDKWalletSource_JCalls {
13977         atomic_size_t refcnt;
13978         uint32_t instance_ptr;
13979 } LDKWalletSource_JCalls;
13980 static void LDKWalletSource_JCalls_free(void* this_arg) {
13981         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
13982         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13983                 FREE(j_calls);
13984         }
13985 }
13986 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
13987         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
13988         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 135, 0, 0, 0, 0, 0, 0);
13989         void* ret_ptr = untag_ptr(ret);
13990         CHECK_ACCESS(ret_ptr);
13991         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
13992         FREE(untag_ptr(ret));
13993         return ret_conv;
13994 }
13995 LDKCResult_ScriptNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
13996         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
13997         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, 0, 0, 0, 0, 0, 0);
13998         void* ret_ptr = untag_ptr(ret);
13999         CHECK_ACCESS(ret_ptr);
14000         LDKCResult_ScriptNoneZ ret_conv = *(LDKCResult_ScriptNoneZ*)(ret_ptr);
14001         FREE(untag_ptr(ret));
14002         return ret_conv;
14003 }
14004 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
14005         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14006         LDKTransaction tx_var = tx;
14007         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
14008         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
14009         Transaction_free(tx_var);
14010         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
14011         void* ret_ptr = untag_ptr(ret);
14012         CHECK_ACCESS(ret_ptr);
14013         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
14014         FREE(untag_ptr(ret));
14015         return ret_conv;
14016 }
14017 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
14018         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
14019         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14020 }
14021 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
14022         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
14023         atomic_init(&calls->refcnt, 1);
14024         calls->instance_ptr = o;
14025
14026         LDKWalletSource ret = {
14027                 .this_arg = (void*) calls,
14028                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
14029                 .get_change_script = get_change_script_LDKWalletSource_jcall,
14030                 .sign_tx = sign_tx_LDKWalletSource_jcall,
14031                 .free = LDKWalletSource_JCalls_free,
14032         };
14033         return ret;
14034 }
14035 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
14036         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
14037         *res_ptr = LDKWalletSource_init(o);
14038         return tag_ptr(res_ptr, true);
14039 }
14040 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
14041         void* this_arg_ptr = untag_ptr(this_arg);
14042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14043         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14044         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
14045         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
14046         return tag_ptr(ret_conv, true);
14047 }
14048
14049 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
14050         void* this_arg_ptr = untag_ptr(this_arg);
14051         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14052         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14053         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
14054         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
14055         return tag_ptr(ret_conv, true);
14056 }
14057
14058 uint64_t  __attribute__((export_name("TS_WalletSource_sign_tx"))) TS_WalletSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
14059         void* this_arg_ptr = untag_ptr(this_arg);
14060         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14061         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14062         LDKTransaction tx_ref;
14063         tx_ref.datalen = tx->arr_len;
14064         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
14065         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
14066         tx_ref.data_is_owned = true;
14067         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14068         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
14069         return tag_ptr(ret_conv, true);
14070 }
14071
14072 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
14073         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14074         switch(obj->tag) {
14075                 case LDKGossipSync_P2P: return 0;
14076                 case LDKGossipSync_Rapid: return 1;
14077                 case LDKGossipSync_None: return 2;
14078                 default: abort();
14079         }
14080 }
14081 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
14082         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14083         assert(obj->tag == LDKGossipSync_P2P);
14084                         LDKP2PGossipSync p2p_var = obj->p2p;
14085                         uint64_t p2p_ref = 0;
14086                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
14087                         p2p_ref = tag_ptr(p2p_var.inner, false);
14088         return p2p_ref;
14089 }
14090 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
14091         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14092         assert(obj->tag == LDKGossipSync_Rapid);
14093                         LDKRapidGossipSync rapid_var = obj->rapid;
14094                         uint64_t rapid_ref = 0;
14095                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
14096                         rapid_ref = tag_ptr(rapid_var.inner, false);
14097         return rapid_ref;
14098 }
14099 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
14100         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14101         switch(obj->tag) {
14102                 case LDKFallback_SegWitProgram: return 0;
14103                 case LDKFallback_PubKeyHash: return 1;
14104                 case LDKFallback_ScriptHash: return 2;
14105                 default: abort();
14106         }
14107 }
14108 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
14109         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14110         assert(obj->tag == LDKFallback_SegWitProgram);
14111                         uint8_t version_val = obj->seg_wit_program.version._0;
14112         return version_val;
14113 }
14114 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
14115         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14116         assert(obj->tag == LDKFallback_SegWitProgram);
14117                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
14118                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
14119                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
14120         return program_arr;
14121 }
14122 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
14123         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14124         assert(obj->tag == LDKFallback_PubKeyHash);
14125                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
14126                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
14127         return pub_key_hash_arr;
14128 }
14129 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
14130         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14131         assert(obj->tag == LDKFallback_ScriptHash);
14132                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
14133                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
14134         return script_hash_arr;
14135 }
14136 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
14137         LDKStr ret_str = _ldk_get_compiled_version();
14138         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
14139         Str_free(ret_str);
14140         return ret_conv;
14141 }
14142
14143 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
14144         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
14145         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
14146         Str_free(ret_str);
14147         return ret_conv;
14148 }
14149
14150 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
14151         LDKU128 val_ref;
14152         CHECK(val->arr_len == 16);
14153         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
14154         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
14155         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
14156         return ret_arr;
14157 }
14158
14159 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
14160         LDKSixteenBytes le_bytes_ref;
14161         CHECK(le_bytes->arr_len == 16);
14162         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
14163         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
14164         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
14165         return ret_arr;
14166 }
14167
14168 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
14169         LDKThirtyTwoBytes big_endian_bytes_ref;
14170         CHECK(big_endian_bytes->arr_len == 32);
14171         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
14172         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
14173         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
14174         return tag_ptr(ret_ref, true);
14175 }
14176
14177 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
14178         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14179         *ret_copy = Bech32Error_clone(arg);
14180         uint64_t ret_ref = tag_ptr(ret_copy, true);
14181         return ret_ref;
14182 }
14183 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
14184         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
14185         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
14186         return ret_conv;
14187 }
14188
14189 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
14190         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
14191         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14192         *ret_copy = Bech32Error_clone(orig_conv);
14193         uint64_t ret_ref = tag_ptr(ret_copy, true);
14194         return ret_ref;
14195 }
14196
14197 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
14198         if (!ptr_is_owned(o)) return;
14199         void* o_ptr = untag_ptr(o);
14200         CHECK_ACCESS(o_ptr);
14201         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
14202         FREE(untag_ptr(o));
14203         Bech32Error_free(o_conv);
14204 }
14205
14206 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
14207         LDKTransaction _res_ref;
14208         _res_ref.datalen = _res->arr_len;
14209         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
14210         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14211         _res_ref.data_is_owned = true;
14212         Transaction_free(_res_ref);
14213 }
14214
14215 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
14216         LDKWitness _res_ref;
14217         _res_ref.datalen = _res->arr_len;
14218         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
14219         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14220         _res_ref.data_is_owned = true;
14221         Witness_free(_res_ref);
14222 }
14223
14224 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
14225         if (!ptr_is_owned(_res)) return;
14226         void* _res_ptr = untag_ptr(_res);
14227         CHECK_ACCESS(_res_ptr);
14228         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
14229         FREE(untag_ptr(_res));
14230         TxIn_free(_res_conv);
14231 }
14232
14233 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) {
14234         LDKWitness witness_ref;
14235         witness_ref.datalen = witness->arr_len;
14236         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
14237         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
14238         witness_ref.data_is_owned = true;
14239         LDKCVec_u8Z script_sig_ref;
14240         script_sig_ref.datalen = script_sig->arr_len;
14241         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
14242         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
14243         LDKThirtyTwoBytes previous_txid_ref;
14244         CHECK(previous_txid->arr_len == 32);
14245         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
14246         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
14247         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
14248         return tag_ptr(ret_ref, true);
14249 }
14250
14251 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
14252         LDKCVec_u8Z script_pubkey_ref;
14253         script_pubkey_ref.datalen = script_pubkey->arr_len;
14254         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
14255         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
14256         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14257         *ret_ref = TxOut_new(script_pubkey_ref, value);
14258         return tag_ptr(ret_ref, true);
14259 }
14260
14261 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
14262         if (!ptr_is_owned(_res)) return;
14263         void* _res_ptr = untag_ptr(_res);
14264         CHECK_ACCESS(_res_ptr);
14265         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
14266         FREE(untag_ptr(_res));
14267         TxOut_free(_res_conv);
14268 }
14269
14270 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
14271         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14272         *ret_ref = TxOut_clone(arg);
14273         return tag_ptr(ret_ref, true);
14274 }
14275 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
14276         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
14277         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
14278         return ret_conv;
14279 }
14280
14281 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
14282         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
14283         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14284         *ret_ref = TxOut_clone(orig_conv);
14285         return tag_ptr(ret_ref, true);
14286 }
14287
14288 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
14289         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
14290         Str_free(dummy);
14291 }
14292
14293 uint64_t  __attribute__((export_name("TS_COption_DurationZ_some"))) TS_COption_DurationZ_some(int64_t o) {
14294         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
14295         *ret_copy = COption_DurationZ_some(o);
14296         uint64_t ret_ref = tag_ptr(ret_copy, true);
14297         return ret_ref;
14298 }
14299
14300 uint64_t  __attribute__((export_name("TS_COption_DurationZ_none"))) TS_COption_DurationZ_none() {
14301         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
14302         *ret_copy = COption_DurationZ_none();
14303         uint64_t ret_ref = tag_ptr(ret_copy, true);
14304         return ret_ref;
14305 }
14306
14307 void  __attribute__((export_name("TS_COption_DurationZ_free"))) TS_COption_DurationZ_free(uint64_t _res) {
14308         if (!ptr_is_owned(_res)) return;
14309         void* _res_ptr = untag_ptr(_res);
14310         CHECK_ACCESS(_res_ptr);
14311         LDKCOption_DurationZ _res_conv = *(LDKCOption_DurationZ*)(_res_ptr);
14312         FREE(untag_ptr(_res));
14313         COption_DurationZ_free(_res_conv);
14314 }
14315
14316 static inline uint64_t COption_DurationZ_clone_ptr(LDKCOption_DurationZ *NONNULL_PTR arg) {
14317         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
14318         *ret_copy = COption_DurationZ_clone(arg);
14319         uint64_t ret_ref = tag_ptr(ret_copy, true);
14320         return ret_ref;
14321 }
14322 int64_t  __attribute__((export_name("TS_COption_DurationZ_clone_ptr"))) TS_COption_DurationZ_clone_ptr(uint64_t arg) {
14323         LDKCOption_DurationZ* arg_conv = (LDKCOption_DurationZ*)untag_ptr(arg);
14324         int64_t ret_conv = COption_DurationZ_clone_ptr(arg_conv);
14325         return ret_conv;
14326 }
14327
14328 uint64_t  __attribute__((export_name("TS_COption_DurationZ_clone"))) TS_COption_DurationZ_clone(uint64_t orig) {
14329         LDKCOption_DurationZ* orig_conv = (LDKCOption_DurationZ*)untag_ptr(orig);
14330         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
14331         *ret_copy = COption_DurationZ_clone(orig_conv);
14332         uint64_t ret_ref = tag_ptr(ret_copy, true);
14333         return ret_ref;
14334 }
14335
14336 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
14337         LDKCVec_BlindedPathZ _res_constr;
14338         _res_constr.datalen = _res->arr_len;
14339         if (_res_constr.datalen > 0)
14340                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
14341         else
14342                 _res_constr.data = NULL;
14343         uint64_t* _res_vals = _res->elems;
14344         for (size_t n = 0; n < _res_constr.datalen; n++) {
14345                 uint64_t _res_conv_13 = _res_vals[n];
14346                 LDKBlindedPath _res_conv_13_conv;
14347                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
14348                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
14349                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
14350                 _res_constr.data[n] = _res_conv_13_conv;
14351         }
14352         FREE(_res);
14353         CVec_BlindedPathZ_free(_res_constr);
14354 }
14355
14356 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
14357         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14358         *ret_copy = COption_u64Z_some(o);
14359         uint64_t ret_ref = tag_ptr(ret_copy, true);
14360         return ret_ref;
14361 }
14362
14363 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
14364         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14365         *ret_copy = COption_u64Z_none();
14366         uint64_t ret_ref = tag_ptr(ret_copy, true);
14367         return ret_ref;
14368 }
14369
14370 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
14371         if (!ptr_is_owned(_res)) return;
14372         void* _res_ptr = untag_ptr(_res);
14373         CHECK_ACCESS(_res_ptr);
14374         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
14375         FREE(untag_ptr(_res));
14376         COption_u64Z_free(_res_conv);
14377 }
14378
14379 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
14380         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14381         *ret_copy = COption_u64Z_clone(arg);
14382         uint64_t ret_ref = tag_ptr(ret_copy, true);
14383         return ret_ref;
14384 }
14385 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
14386         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
14387         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
14388         return ret_conv;
14389 }
14390
14391 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
14392         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
14393         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14394         *ret_copy = COption_u64Z_clone(orig_conv);
14395         uint64_t ret_ref = tag_ptr(ret_copy, true);
14396         return ret_ref;
14397 }
14398
14399 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
14400         LDKRefund o_conv;
14401         o_conv.inner = untag_ptr(o);
14402         o_conv.is_owned = ptr_is_owned(o);
14403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14404         o_conv = Refund_clone(&o_conv);
14405         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
14406         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
14407         return tag_ptr(ret_conv, true);
14408 }
14409
14410 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
14411         LDKBolt12ParseError e_conv;
14412         e_conv.inner = untag_ptr(e);
14413         e_conv.is_owned = ptr_is_owned(e);
14414         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14415         e_conv = Bolt12ParseError_clone(&e_conv);
14416         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
14417         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
14418         return tag_ptr(ret_conv, true);
14419 }
14420
14421 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
14422         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
14423         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
14424         return ret_conv;
14425 }
14426
14427 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
14428         if (!ptr_is_owned(_res)) return;
14429         void* _res_ptr = untag_ptr(_res);
14430         CHECK_ACCESS(_res_ptr);
14431         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
14432         FREE(untag_ptr(_res));
14433         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
14434 }
14435
14436 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
14437         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
14438         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
14439         return tag_ptr(ret_conv, true);
14440 }
14441 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
14442         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
14443         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
14444         return ret_conv;
14445 }
14446
14447 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
14448         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
14449         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
14450         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
14451         return tag_ptr(ret_conv, true);
14452 }
14453
14454 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
14455         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14456         *ret_conv = CResult_NoneAPIErrorZ_ok();
14457         return tag_ptr(ret_conv, true);
14458 }
14459
14460 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
14461         void* e_ptr = untag_ptr(e);
14462         CHECK_ACCESS(e_ptr);
14463         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14464         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
14465         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14466         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
14467         return tag_ptr(ret_conv, true);
14468 }
14469
14470 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
14471         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
14472         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
14473         return ret_conv;
14474 }
14475
14476 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
14477         if (!ptr_is_owned(_res)) return;
14478         void* _res_ptr = untag_ptr(_res);
14479         CHECK_ACCESS(_res_ptr);
14480         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
14481         FREE(untag_ptr(_res));
14482         CResult_NoneAPIErrorZ_free(_res_conv);
14483 }
14484
14485 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
14486         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14487         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
14488         return tag_ptr(ret_conv, true);
14489 }
14490 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
14491         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
14492         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
14493         return ret_conv;
14494 }
14495
14496 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
14497         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
14498         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14499         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
14500         return tag_ptr(ret_conv, true);
14501 }
14502
14503 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
14504         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
14505         _res_constr.datalen = _res->arr_len;
14506         if (_res_constr.datalen > 0)
14507                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14508         else
14509                 _res_constr.data = NULL;
14510         uint64_t* _res_vals = _res->elems;
14511         for (size_t w = 0; w < _res_constr.datalen; w++) {
14512                 uint64_t _res_conv_22 = _res_vals[w];
14513                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
14514                 CHECK_ACCESS(_res_conv_22_ptr);
14515                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
14516                 FREE(untag_ptr(_res_conv_22));
14517                 _res_constr.data[w] = _res_conv_22_conv;
14518         }
14519         FREE(_res);
14520         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
14521 }
14522
14523 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
14524         LDKCVec_APIErrorZ _res_constr;
14525         _res_constr.datalen = _res->arr_len;
14526         if (_res_constr.datalen > 0)
14527                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
14528         else
14529                 _res_constr.data = NULL;
14530         uint64_t* _res_vals = _res->elems;
14531         for (size_t k = 0; k < _res_constr.datalen; k++) {
14532                 uint64_t _res_conv_10 = _res_vals[k];
14533                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
14534                 CHECK_ACCESS(_res_conv_10_ptr);
14535                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
14536                 FREE(untag_ptr(_res_conv_10));
14537                 _res_constr.data[k] = _res_conv_10_conv;
14538         }
14539         FREE(_res);
14540         CVec_APIErrorZ_free(_res_constr);
14541 }
14542
14543 uint64_t  __attribute__((export_name("TS_COption_PaymentSecretZ_some"))) TS_COption_PaymentSecretZ_some(int8_tArray o) {
14544         LDKThirtyTwoBytes o_ref;
14545         CHECK(o->arr_len == 32);
14546         memcpy(o_ref.data, o->elems, 32); FREE(o);
14547         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
14548         *ret_copy = COption_PaymentSecretZ_some(o_ref);
14549         uint64_t ret_ref = tag_ptr(ret_copy, true);
14550         return ret_ref;
14551 }
14552
14553 uint64_t  __attribute__((export_name("TS_COption_PaymentSecretZ_none"))) TS_COption_PaymentSecretZ_none() {
14554         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
14555         *ret_copy = COption_PaymentSecretZ_none();
14556         uint64_t ret_ref = tag_ptr(ret_copy, true);
14557         return ret_ref;
14558 }
14559
14560 void  __attribute__((export_name("TS_COption_PaymentSecretZ_free"))) TS_COption_PaymentSecretZ_free(uint64_t _res) {
14561         if (!ptr_is_owned(_res)) return;
14562         void* _res_ptr = untag_ptr(_res);
14563         CHECK_ACCESS(_res_ptr);
14564         LDKCOption_PaymentSecretZ _res_conv = *(LDKCOption_PaymentSecretZ*)(_res_ptr);
14565         FREE(untag_ptr(_res));
14566         COption_PaymentSecretZ_free(_res_conv);
14567 }
14568
14569 static inline uint64_t COption_PaymentSecretZ_clone_ptr(LDKCOption_PaymentSecretZ *NONNULL_PTR arg) {
14570         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
14571         *ret_copy = COption_PaymentSecretZ_clone(arg);
14572         uint64_t ret_ref = tag_ptr(ret_copy, true);
14573         return ret_ref;
14574 }
14575 int64_t  __attribute__((export_name("TS_COption_PaymentSecretZ_clone_ptr"))) TS_COption_PaymentSecretZ_clone_ptr(uint64_t arg) {
14576         LDKCOption_PaymentSecretZ* arg_conv = (LDKCOption_PaymentSecretZ*)untag_ptr(arg);
14577         int64_t ret_conv = COption_PaymentSecretZ_clone_ptr(arg_conv);
14578         return ret_conv;
14579 }
14580
14581 uint64_t  __attribute__((export_name("TS_COption_PaymentSecretZ_clone"))) TS_COption_PaymentSecretZ_clone(uint64_t orig) {
14582         LDKCOption_PaymentSecretZ* orig_conv = (LDKCOption_PaymentSecretZ*)untag_ptr(orig);
14583         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
14584         *ret_copy = COption_PaymentSecretZ_clone(orig_conv);
14585         uint64_t ret_ref = tag_ptr(ret_copy, true);
14586         return ret_ref;
14587 }
14588
14589 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
14590         LDKCVec_u8Z _res_ref;
14591         _res_ref.datalen = _res->arr_len;
14592         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
14593         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14594         CVec_u8Z_free(_res_ref);
14595 }
14596
14597 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
14598         LDKCVec_u8Z o_ref;
14599         o_ref.datalen = o->arr_len;
14600         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
14601         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
14602         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
14603         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
14604         uint64_t ret_ref = tag_ptr(ret_copy, true);
14605         return ret_ref;
14606 }
14607
14608 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
14609         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
14610         *ret_copy = COption_CVec_u8ZZ_none();
14611         uint64_t ret_ref = tag_ptr(ret_copy, true);
14612         return ret_ref;
14613 }
14614
14615 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
14616         if (!ptr_is_owned(_res)) return;
14617         void* _res_ptr = untag_ptr(_res);
14618         CHECK_ACCESS(_res_ptr);
14619         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
14620         FREE(untag_ptr(_res));
14621         COption_CVec_u8ZZ_free(_res_conv);
14622 }
14623
14624 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
14625         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
14626         *ret_copy = COption_CVec_u8ZZ_clone(arg);
14627         uint64_t ret_ref = tag_ptr(ret_copy, true);
14628         return ret_ref;
14629 }
14630 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
14631         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
14632         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
14633         return ret_conv;
14634 }
14635
14636 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
14637         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
14638         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
14639         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
14640         uint64_t ret_ref = tag_ptr(ret_copy, true);
14641         return ret_ref;
14642 }
14643
14644 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
14645         LDKRecipientOnionFields o_conv;
14646         o_conv.inner = untag_ptr(o);
14647         o_conv.is_owned = ptr_is_owned(o);
14648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14649         o_conv = RecipientOnionFields_clone(&o_conv);
14650         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
14651         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
14652         return tag_ptr(ret_conv, true);
14653 }
14654
14655 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
14656         void* e_ptr = untag_ptr(e);
14657         CHECK_ACCESS(e_ptr);
14658         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14659         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14660         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
14661         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
14662         return tag_ptr(ret_conv, true);
14663 }
14664
14665 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
14666         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
14667         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
14668         return ret_conv;
14669 }
14670
14671 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
14672         if (!ptr_is_owned(_res)) return;
14673         void* _res_ptr = untag_ptr(_res);
14674         CHECK_ACCESS(_res_ptr);
14675         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
14676         FREE(untag_ptr(_res));
14677         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
14678 }
14679
14680 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
14681         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
14682         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
14683         return tag_ptr(ret_conv, true);
14684 }
14685 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
14686         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
14687         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
14688         return ret_conv;
14689 }
14690
14691 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
14692         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
14693         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
14694         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
14695         return tag_ptr(ret_conv, true);
14696 }
14697
14698 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
14699         void* o_ptr = untag_ptr(o);
14700         CHECK_ACCESS(o_ptr);
14701         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
14702         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
14703         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14704         *ret_copy = COption_OffersMessageZ_some(o_conv);
14705         uint64_t ret_ref = tag_ptr(ret_copy, true);
14706         return ret_ref;
14707 }
14708
14709 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
14710         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14711         *ret_copy = COption_OffersMessageZ_none();
14712         uint64_t ret_ref = tag_ptr(ret_copy, true);
14713         return ret_ref;
14714 }
14715
14716 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
14717         if (!ptr_is_owned(_res)) return;
14718         void* _res_ptr = untag_ptr(_res);
14719         CHECK_ACCESS(_res_ptr);
14720         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
14721         FREE(untag_ptr(_res));
14722         COption_OffersMessageZ_free(_res_conv);
14723 }
14724
14725 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
14726         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14727         *ret_copy = COption_OffersMessageZ_clone(arg);
14728         uint64_t ret_ref = tag_ptr(ret_copy, true);
14729         return ret_ref;
14730 }
14731 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
14732         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
14733         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
14734         return ret_conv;
14735 }
14736
14737 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
14738         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
14739         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14740         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
14741         uint64_t ret_ref = tag_ptr(ret_copy, true);
14742         return ret_ref;
14743 }
14744
14745 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
14746         void* o_ptr = untag_ptr(o);
14747         CHECK_ACCESS(o_ptr);
14748         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
14749         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
14750         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
14751         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
14752         return tag_ptr(ret_conv, true);
14753 }
14754
14755 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
14756         void* e_ptr = untag_ptr(e);
14757         CHECK_ACCESS(e_ptr);
14758         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14759         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14760         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
14761         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
14762         return tag_ptr(ret_conv, true);
14763 }
14764
14765 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
14766         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
14767         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
14768         return ret_conv;
14769 }
14770
14771 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
14772         if (!ptr_is_owned(_res)) return;
14773         void* _res_ptr = untag_ptr(_res);
14774         CHECK_ACCESS(_res_ptr);
14775         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
14776         FREE(untag_ptr(_res));
14777         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
14778 }
14779
14780 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
14781         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
14782         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
14783         return tag_ptr(ret_conv, true);
14784 }
14785 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
14786         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
14787         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
14788         return ret_conv;
14789 }
14790
14791 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
14792         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
14793         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
14794         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
14795         return tag_ptr(ret_conv, true);
14796 }
14797
14798 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
14799         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
14800         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
14801         *ret_copy = COption_HTLCClaimZ_some(o_conv);
14802         uint64_t ret_ref = tag_ptr(ret_copy, true);
14803         return ret_ref;
14804 }
14805
14806 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
14807         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
14808         *ret_copy = COption_HTLCClaimZ_none();
14809         uint64_t ret_ref = tag_ptr(ret_copy, true);
14810         return ret_ref;
14811 }
14812
14813 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
14814         if (!ptr_is_owned(_res)) return;
14815         void* _res_ptr = untag_ptr(_res);
14816         CHECK_ACCESS(_res_ptr);
14817         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
14818         FREE(untag_ptr(_res));
14819         COption_HTLCClaimZ_free(_res_conv);
14820 }
14821
14822 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
14823         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14824         *ret_conv = CResult_NoneNoneZ_ok();
14825         return tag_ptr(ret_conv, true);
14826 }
14827
14828 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
14829         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14830         *ret_conv = CResult_NoneNoneZ_err();
14831         return tag_ptr(ret_conv, true);
14832 }
14833
14834 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
14835         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
14836         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
14837         return ret_conv;
14838 }
14839
14840 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
14841         if (!ptr_is_owned(_res)) return;
14842         void* _res_ptr = untag_ptr(_res);
14843         CHECK_ACCESS(_res_ptr);
14844         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14845         FREE(untag_ptr(_res));
14846         CResult_NoneNoneZ_free(_res_conv);
14847 }
14848
14849 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14850         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14851         *ret_conv = CResult_NoneNoneZ_clone(arg);
14852         return tag_ptr(ret_conv, true);
14853 }
14854 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
14855         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
14856         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
14857         return ret_conv;
14858 }
14859
14860 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
14861         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
14862         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14863         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14864         return tag_ptr(ret_conv, true);
14865 }
14866
14867 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
14868         LDKCounterpartyCommitmentSecrets o_conv;
14869         o_conv.inner = untag_ptr(o);
14870         o_conv.is_owned = ptr_is_owned(o);
14871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14872         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
14873         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14874         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
14875         return tag_ptr(ret_conv, true);
14876 }
14877
14878 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
14879         void* e_ptr = untag_ptr(e);
14880         CHECK_ACCESS(e_ptr);
14881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14883         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14884         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
14885         return tag_ptr(ret_conv, true);
14886 }
14887
14888 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
14889         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
14890         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
14891         return ret_conv;
14892 }
14893
14894 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
14895         if (!ptr_is_owned(_res)) return;
14896         void* _res_ptr = untag_ptr(_res);
14897         CHECK_ACCESS(_res_ptr);
14898         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
14899         FREE(untag_ptr(_res));
14900         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
14901 }
14902
14903 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
14904         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14905         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
14906         return tag_ptr(ret_conv, true);
14907 }
14908 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
14909         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
14910         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
14911         return ret_conv;
14912 }
14913
14914 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
14915         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
14916         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14917         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
14918         return tag_ptr(ret_conv, true);
14919 }
14920
14921 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
14922         LDKTxCreationKeys o_conv;
14923         o_conv.inner = untag_ptr(o);
14924         o_conv.is_owned = ptr_is_owned(o);
14925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14926         o_conv = TxCreationKeys_clone(&o_conv);
14927         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14928         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
14929         return tag_ptr(ret_conv, true);
14930 }
14931
14932 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
14933         void* e_ptr = untag_ptr(e);
14934         CHECK_ACCESS(e_ptr);
14935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14937         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14938         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
14939         return tag_ptr(ret_conv, true);
14940 }
14941
14942 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
14943         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
14944         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
14945         return ret_conv;
14946 }
14947
14948 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
14949         if (!ptr_is_owned(_res)) return;
14950         void* _res_ptr = untag_ptr(_res);
14951         CHECK_ACCESS(_res_ptr);
14952         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
14953         FREE(untag_ptr(_res));
14954         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
14955 }
14956
14957 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
14958         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14959         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
14960         return tag_ptr(ret_conv, true);
14961 }
14962 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
14963         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
14964         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
14965         return ret_conv;
14966 }
14967
14968 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
14969         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
14970         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14971         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
14972         return tag_ptr(ret_conv, true);
14973 }
14974
14975 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
14976         LDKChannelPublicKeys o_conv;
14977         o_conv.inner = untag_ptr(o);
14978         o_conv.is_owned = ptr_is_owned(o);
14979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14980         o_conv = ChannelPublicKeys_clone(&o_conv);
14981         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14982         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
14983         return tag_ptr(ret_conv, true);
14984 }
14985
14986 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
14987         void* e_ptr = untag_ptr(e);
14988         CHECK_ACCESS(e_ptr);
14989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14991         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14992         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14993         return tag_ptr(ret_conv, true);
14994 }
14995
14996 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
14997         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
14998         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
14999         return ret_conv;
15000 }
15001
15002 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
15003         if (!ptr_is_owned(_res)) return;
15004         void* _res_ptr = untag_ptr(_res);
15005         CHECK_ACCESS(_res_ptr);
15006         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
15007         FREE(untag_ptr(_res));
15008         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
15009 }
15010
15011 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
15012         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15013         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
15014         return tag_ptr(ret_conv, true);
15015 }
15016 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
15017         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
15018         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
15019         return ret_conv;
15020 }
15021
15022 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
15023         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
15024         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15025         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
15026         return tag_ptr(ret_conv, true);
15027 }
15028
15029 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
15030         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15031         *ret_copy = COption_u32Z_some(o);
15032         uint64_t ret_ref = tag_ptr(ret_copy, true);
15033         return ret_ref;
15034 }
15035
15036 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
15037         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15038         *ret_copy = COption_u32Z_none();
15039         uint64_t ret_ref = tag_ptr(ret_copy, true);
15040         return ret_ref;
15041 }
15042
15043 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
15044         if (!ptr_is_owned(_res)) return;
15045         void* _res_ptr = untag_ptr(_res);
15046         CHECK_ACCESS(_res_ptr);
15047         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
15048         FREE(untag_ptr(_res));
15049         COption_u32Z_free(_res_conv);
15050 }
15051
15052 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
15053         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15054         *ret_copy = COption_u32Z_clone(arg);
15055         uint64_t ret_ref = tag_ptr(ret_copy, true);
15056         return ret_ref;
15057 }
15058 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
15059         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
15060         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
15061         return ret_conv;
15062 }
15063
15064 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
15065         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
15066         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15067         *ret_copy = COption_u32Z_clone(orig_conv);
15068         uint64_t ret_ref = tag_ptr(ret_copy, true);
15069         return ret_ref;
15070 }
15071
15072 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
15073         LDKHTLCOutputInCommitment o_conv;
15074         o_conv.inner = untag_ptr(o);
15075         o_conv.is_owned = ptr_is_owned(o);
15076         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15077         o_conv = HTLCOutputInCommitment_clone(&o_conv);
15078         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15079         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
15080         return tag_ptr(ret_conv, true);
15081 }
15082
15083 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
15084         void* e_ptr = untag_ptr(e);
15085         CHECK_ACCESS(e_ptr);
15086         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15087         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15088         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15089         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
15090         return tag_ptr(ret_conv, true);
15091 }
15092
15093 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
15094         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
15095         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
15096         return ret_conv;
15097 }
15098
15099 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
15100         if (!ptr_is_owned(_res)) return;
15101         void* _res_ptr = untag_ptr(_res);
15102         CHECK_ACCESS(_res_ptr);
15103         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
15104         FREE(untag_ptr(_res));
15105         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
15106 }
15107
15108 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
15109         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15110         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
15111         return tag_ptr(ret_conv, true);
15112 }
15113 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
15114         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
15115         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
15116         return ret_conv;
15117 }
15118
15119 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
15120         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
15121         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15122         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
15123         return tag_ptr(ret_conv, true);
15124 }
15125
15126 uint64_t  __attribute__((export_name("TS_COption_PaymentPreimageZ_some"))) TS_COption_PaymentPreimageZ_some(int8_tArray o) {
15127         LDKThirtyTwoBytes o_ref;
15128         CHECK(o->arr_len == 32);
15129         memcpy(o_ref.data, o->elems, 32); FREE(o);
15130         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
15131         *ret_copy = COption_PaymentPreimageZ_some(o_ref);
15132         uint64_t ret_ref = tag_ptr(ret_copy, true);
15133         return ret_ref;
15134 }
15135
15136 uint64_t  __attribute__((export_name("TS_COption_PaymentPreimageZ_none"))) TS_COption_PaymentPreimageZ_none() {
15137         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
15138         *ret_copy = COption_PaymentPreimageZ_none();
15139         uint64_t ret_ref = tag_ptr(ret_copy, true);
15140         return ret_ref;
15141 }
15142
15143 void  __attribute__((export_name("TS_COption_PaymentPreimageZ_free"))) TS_COption_PaymentPreimageZ_free(uint64_t _res) {
15144         if (!ptr_is_owned(_res)) return;
15145         void* _res_ptr = untag_ptr(_res);
15146         CHECK_ACCESS(_res_ptr);
15147         LDKCOption_PaymentPreimageZ _res_conv = *(LDKCOption_PaymentPreimageZ*)(_res_ptr);
15148         FREE(untag_ptr(_res));
15149         COption_PaymentPreimageZ_free(_res_conv);
15150 }
15151
15152 static inline uint64_t COption_PaymentPreimageZ_clone_ptr(LDKCOption_PaymentPreimageZ *NONNULL_PTR arg) {
15153         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
15154         *ret_copy = COption_PaymentPreimageZ_clone(arg);
15155         uint64_t ret_ref = tag_ptr(ret_copy, true);
15156         return ret_ref;
15157 }
15158 int64_t  __attribute__((export_name("TS_COption_PaymentPreimageZ_clone_ptr"))) TS_COption_PaymentPreimageZ_clone_ptr(uint64_t arg) {
15159         LDKCOption_PaymentPreimageZ* arg_conv = (LDKCOption_PaymentPreimageZ*)untag_ptr(arg);
15160         int64_t ret_conv = COption_PaymentPreimageZ_clone_ptr(arg_conv);
15161         return ret_conv;
15162 }
15163
15164 uint64_t  __attribute__((export_name("TS_COption_PaymentPreimageZ_clone"))) TS_COption_PaymentPreimageZ_clone(uint64_t orig) {
15165         LDKCOption_PaymentPreimageZ* orig_conv = (LDKCOption_PaymentPreimageZ*)untag_ptr(orig);
15166         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
15167         *ret_copy = COption_PaymentPreimageZ_clone(orig_conv);
15168         uint64_t ret_ref = tag_ptr(ret_copy, true);
15169         return ret_ref;
15170 }
15171
15172 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
15173         LDKCounterpartyChannelTransactionParameters o_conv;
15174         o_conv.inner = untag_ptr(o);
15175         o_conv.is_owned = ptr_is_owned(o);
15176         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15177         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
15178         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15179         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15180         return tag_ptr(ret_conv, true);
15181 }
15182
15183 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
15184         void* e_ptr = untag_ptr(e);
15185         CHECK_ACCESS(e_ptr);
15186         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15187         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15188         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15189         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
15190         return tag_ptr(ret_conv, true);
15191 }
15192
15193 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
15194         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
15195         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15196         return ret_conv;
15197 }
15198
15199 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
15200         if (!ptr_is_owned(_res)) return;
15201         void* _res_ptr = untag_ptr(_res);
15202         CHECK_ACCESS(_res_ptr);
15203         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15204         FREE(untag_ptr(_res));
15205         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15206 }
15207
15208 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15209         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15210         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
15211         return tag_ptr(ret_conv, true);
15212 }
15213 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
15214         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
15215         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15216         return ret_conv;
15217 }
15218
15219 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
15220         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
15221         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15222         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15223         return tag_ptr(ret_conv, true);
15224 }
15225
15226 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
15227         LDKChannelTransactionParameters o_conv;
15228         o_conv.inner = untag_ptr(o);
15229         o_conv.is_owned = ptr_is_owned(o);
15230         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15231         o_conv = ChannelTransactionParameters_clone(&o_conv);
15232         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15233         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15234         return tag_ptr(ret_conv, true);
15235 }
15236
15237 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
15238         void* e_ptr = untag_ptr(e);
15239         CHECK_ACCESS(e_ptr);
15240         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15241         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15242         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15243         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
15244         return tag_ptr(ret_conv, true);
15245 }
15246
15247 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
15248         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
15249         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15250         return ret_conv;
15251 }
15252
15253 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
15254         if (!ptr_is_owned(_res)) return;
15255         void* _res_ptr = untag_ptr(_res);
15256         CHECK_ACCESS(_res_ptr);
15257         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15258         FREE(untag_ptr(_res));
15259         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15260 }
15261
15262 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15263         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15264         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
15265         return tag_ptr(ret_conv, true);
15266 }
15267 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
15268         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
15269         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15270         return ret_conv;
15271 }
15272
15273 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
15274         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
15275         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15276         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15277         return tag_ptr(ret_conv, true);
15278 }
15279
15280 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
15281         LDKCVec_SignatureZ _res_constr;
15282         _res_constr.datalen = _res->arr_len;
15283         if (_res_constr.datalen > 0)
15284                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15285         else
15286                 _res_constr.data = NULL;
15287         int8_tArray* _res_vals = (void*) _res->elems;
15288         for (size_t m = 0; m < _res_constr.datalen; m++) {
15289                 int8_tArray _res_conv_12 = _res_vals[m];
15290                 LDKSignature _res_conv_12_ref;
15291                 CHECK(_res_conv_12->arr_len == 64);
15292                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
15293                 _res_constr.data[m] = _res_conv_12_ref;
15294         }
15295         FREE(_res);
15296         CVec_SignatureZ_free(_res_constr);
15297 }
15298
15299 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
15300         LDKHolderCommitmentTransaction o_conv;
15301         o_conv.inner = untag_ptr(o);
15302         o_conv.is_owned = ptr_is_owned(o);
15303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15304         o_conv = HolderCommitmentTransaction_clone(&o_conv);
15305         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15306         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
15307         return tag_ptr(ret_conv, true);
15308 }
15309
15310 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
15311         void* e_ptr = untag_ptr(e);
15312         CHECK_ACCESS(e_ptr);
15313         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15314         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15315         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15316         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
15317         return tag_ptr(ret_conv, true);
15318 }
15319
15320 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
15321         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
15322         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15323         return ret_conv;
15324 }
15325
15326 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
15327         if (!ptr_is_owned(_res)) return;
15328         void* _res_ptr = untag_ptr(_res);
15329         CHECK_ACCESS(_res_ptr);
15330         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15331         FREE(untag_ptr(_res));
15332         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
15333 }
15334
15335 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15336         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15337         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
15338         return tag_ptr(ret_conv, true);
15339 }
15340 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
15341         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
15342         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15343         return ret_conv;
15344 }
15345
15346 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
15347         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
15348         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15349         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15350         return tag_ptr(ret_conv, true);
15351 }
15352
15353 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
15354         LDKBuiltCommitmentTransaction o_conv;
15355         o_conv.inner = untag_ptr(o);
15356         o_conv.is_owned = ptr_is_owned(o);
15357         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15358         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
15359         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15360         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
15361         return tag_ptr(ret_conv, true);
15362 }
15363
15364 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
15365         void* e_ptr = untag_ptr(e);
15366         CHECK_ACCESS(e_ptr);
15367         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15368         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15369         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15370         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
15371         return tag_ptr(ret_conv, true);
15372 }
15373
15374 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
15375         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
15376         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15377         return ret_conv;
15378 }
15379
15380 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
15381         if (!ptr_is_owned(_res)) return;
15382         void* _res_ptr = untag_ptr(_res);
15383         CHECK_ACCESS(_res_ptr);
15384         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15385         FREE(untag_ptr(_res));
15386         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
15387 }
15388
15389 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15390         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15391         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
15392         return tag_ptr(ret_conv, true);
15393 }
15394 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
15395         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
15396         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15397         return ret_conv;
15398 }
15399
15400 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
15401         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
15402         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15403         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15404         return tag_ptr(ret_conv, true);
15405 }
15406
15407 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
15408         LDKTrustedClosingTransaction o_conv;
15409         o_conv.inner = untag_ptr(o);
15410         o_conv.is_owned = ptr_is_owned(o);
15411         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15412         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
15413         
15414         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15415         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
15416         return tag_ptr(ret_conv, true);
15417 }
15418
15419 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
15420         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15421         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
15422         return tag_ptr(ret_conv, true);
15423 }
15424
15425 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
15426         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
15427         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
15428         return ret_conv;
15429 }
15430
15431 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
15432         if (!ptr_is_owned(_res)) return;
15433         void* _res_ptr = untag_ptr(_res);
15434         CHECK_ACCESS(_res_ptr);
15435         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
15436         FREE(untag_ptr(_res));
15437         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
15438 }
15439
15440 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
15441         LDKCommitmentTransaction o_conv;
15442         o_conv.inner = untag_ptr(o);
15443         o_conv.is_owned = ptr_is_owned(o);
15444         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15445         o_conv = CommitmentTransaction_clone(&o_conv);
15446         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15447         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
15448         return tag_ptr(ret_conv, true);
15449 }
15450
15451 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
15452         void* e_ptr = untag_ptr(e);
15453         CHECK_ACCESS(e_ptr);
15454         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15455         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15456         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15457         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
15458         return tag_ptr(ret_conv, true);
15459 }
15460
15461 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
15462         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
15463         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15464         return ret_conv;
15465 }
15466
15467 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
15468         if (!ptr_is_owned(_res)) return;
15469         void* _res_ptr = untag_ptr(_res);
15470         CHECK_ACCESS(_res_ptr);
15471         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
15472         FREE(untag_ptr(_res));
15473         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
15474 }
15475
15476 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15477         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15478         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
15479         return tag_ptr(ret_conv, true);
15480 }
15481 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
15482         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
15483         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15484         return ret_conv;
15485 }
15486
15487 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
15488         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
15489         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15490         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
15491         return tag_ptr(ret_conv, true);
15492 }
15493
15494 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
15495         LDKTrustedCommitmentTransaction o_conv;
15496         o_conv.inner = untag_ptr(o);
15497         o_conv.is_owned = ptr_is_owned(o);
15498         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15499         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
15500         
15501         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15502         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
15503         return tag_ptr(ret_conv, true);
15504 }
15505
15506 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
15507         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15508         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
15509         return tag_ptr(ret_conv, true);
15510 }
15511
15512 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
15513         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
15514         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
15515         return ret_conv;
15516 }
15517
15518 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
15519         if (!ptr_is_owned(_res)) return;
15520         void* _res_ptr = untag_ptr(_res);
15521         CHECK_ACCESS(_res_ptr);
15522         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
15523         FREE(untag_ptr(_res));
15524         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
15525 }
15526
15527 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
15528         LDKCVec_SignatureZ o_constr;
15529         o_constr.datalen = o->arr_len;
15530         if (o_constr.datalen > 0)
15531                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15532         else
15533                 o_constr.data = NULL;
15534         int8_tArray* o_vals = (void*) o->elems;
15535         for (size_t m = 0; m < o_constr.datalen; m++) {
15536                 int8_tArray o_conv_12 = o_vals[m];
15537                 LDKSignature o_conv_12_ref;
15538                 CHECK(o_conv_12->arr_len == 64);
15539                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
15540                 o_constr.data[m] = o_conv_12_ref;
15541         }
15542         FREE(o);
15543         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15544         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
15545         return tag_ptr(ret_conv, true);
15546 }
15547
15548 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
15549         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15550         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
15551         return tag_ptr(ret_conv, true);
15552 }
15553
15554 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
15555         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
15556         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
15557         return ret_conv;
15558 }
15559
15560 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
15561         if (!ptr_is_owned(_res)) return;
15562         void* _res_ptr = untag_ptr(_res);
15563         CHECK_ACCESS(_res_ptr);
15564         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
15565         FREE(untag_ptr(_res));
15566         CResult_CVec_SignatureZNoneZ_free(_res_conv);
15567 }
15568
15569 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
15570         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15571         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
15572         return tag_ptr(ret_conv, true);
15573 }
15574 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
15575         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
15576         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
15577         return ret_conv;
15578 }
15579
15580 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
15581         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
15582         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15583         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
15584         return tag_ptr(ret_conv, true);
15585 }
15586
15587 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
15588         LDKShutdownScript o_conv;
15589         o_conv.inner = untag_ptr(o);
15590         o_conv.is_owned = ptr_is_owned(o);
15591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15592         o_conv = ShutdownScript_clone(&o_conv);
15593         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15594         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
15595         return tag_ptr(ret_conv, true);
15596 }
15597
15598 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
15599         void* e_ptr = untag_ptr(e);
15600         CHECK_ACCESS(e_ptr);
15601         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15602         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15603         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15604         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
15605         return tag_ptr(ret_conv, true);
15606 }
15607
15608 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
15609         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
15610         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
15611         return ret_conv;
15612 }
15613
15614 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
15615         if (!ptr_is_owned(_res)) return;
15616         void* _res_ptr = untag_ptr(_res);
15617         CHECK_ACCESS(_res_ptr);
15618         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
15619         FREE(untag_ptr(_res));
15620         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
15621 }
15622
15623 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
15624         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15625         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
15626         return tag_ptr(ret_conv, true);
15627 }
15628 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
15629         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
15630         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
15631         return ret_conv;
15632 }
15633
15634 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
15635         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
15636         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15637         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
15638         return tag_ptr(ret_conv, true);
15639 }
15640
15641 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
15642         LDKShutdownScript o_conv;
15643         o_conv.inner = untag_ptr(o);
15644         o_conv.is_owned = ptr_is_owned(o);
15645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15646         o_conv = ShutdownScript_clone(&o_conv);
15647         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15648         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
15649         return tag_ptr(ret_conv, true);
15650 }
15651
15652 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
15653         LDKInvalidShutdownScript e_conv;
15654         e_conv.inner = untag_ptr(e);
15655         e_conv.is_owned = ptr_is_owned(e);
15656         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15657         e_conv = InvalidShutdownScript_clone(&e_conv);
15658         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15659         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
15660         return tag_ptr(ret_conv, true);
15661 }
15662
15663 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
15664         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
15665         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
15666         return ret_conv;
15667 }
15668
15669 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
15670         if (!ptr_is_owned(_res)) return;
15671         void* _res_ptr = untag_ptr(_res);
15672         CHECK_ACCESS(_res_ptr);
15673         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
15674         FREE(untag_ptr(_res));
15675         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
15676 }
15677
15678 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
15679         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15680         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
15681         return tag_ptr(ret_conv, true);
15682 }
15683 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
15684         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
15685         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
15686         return ret_conv;
15687 }
15688
15689 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
15690         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
15691         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15692         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
15693         return tag_ptr(ret_conv, true);
15694 }
15695
15696 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
15697         LDKBlindedPayInfo o_conv;
15698         o_conv.inner = untag_ptr(o);
15699         o_conv.is_owned = ptr_is_owned(o);
15700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15701         o_conv = BlindedPayInfo_clone(&o_conv);
15702         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15703         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
15704         return tag_ptr(ret_conv, true);
15705 }
15706
15707 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
15708         void* e_ptr = untag_ptr(e);
15709         CHECK_ACCESS(e_ptr);
15710         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15711         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15712         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15713         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
15714         return tag_ptr(ret_conv, true);
15715 }
15716
15717 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
15718         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
15719         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
15720         return ret_conv;
15721 }
15722
15723 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
15724         if (!ptr_is_owned(_res)) return;
15725         void* _res_ptr = untag_ptr(_res);
15726         CHECK_ACCESS(_res_ptr);
15727         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
15728         FREE(untag_ptr(_res));
15729         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
15730 }
15731
15732 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
15733         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15734         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
15735         return tag_ptr(ret_conv, true);
15736 }
15737 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15738         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
15739         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
15740         return ret_conv;
15741 }
15742
15743 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
15744         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
15745         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15746         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
15747         return tag_ptr(ret_conv, true);
15748 }
15749
15750 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15751         LDKDelayedPaymentOutputDescriptor o_conv;
15752         o_conv.inner = untag_ptr(o);
15753         o_conv.is_owned = ptr_is_owned(o);
15754         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15755         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15756         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15757         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15758         return tag_ptr(ret_conv, true);
15759 }
15760
15761 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15762         void* e_ptr = untag_ptr(e);
15763         CHECK_ACCESS(e_ptr);
15764         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15765         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15766         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15767         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15768         return tag_ptr(ret_conv, true);
15769 }
15770
15771 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15772         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15773         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15774         return ret_conv;
15775 }
15776
15777 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15778         if (!ptr_is_owned(_res)) return;
15779         void* _res_ptr = untag_ptr(_res);
15780         CHECK_ACCESS(_res_ptr);
15781         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15782         FREE(untag_ptr(_res));
15783         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15784 }
15785
15786 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15787         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15788         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15789         return tag_ptr(ret_conv, true);
15790 }
15791 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15792         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15793         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15794         return ret_conv;
15795 }
15796
15797 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15798         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15799         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15800         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15801         return tag_ptr(ret_conv, true);
15802 }
15803
15804 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15805         LDKStaticPaymentOutputDescriptor o_conv;
15806         o_conv.inner = untag_ptr(o);
15807         o_conv.is_owned = ptr_is_owned(o);
15808         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15809         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15810         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15811         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15812         return tag_ptr(ret_conv, true);
15813 }
15814
15815 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15816         void* e_ptr = untag_ptr(e);
15817         CHECK_ACCESS(e_ptr);
15818         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15819         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15820         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15821         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15822         return tag_ptr(ret_conv, true);
15823 }
15824
15825 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15826         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15827         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15828         return ret_conv;
15829 }
15830
15831 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15832         if (!ptr_is_owned(_res)) return;
15833         void* _res_ptr = untag_ptr(_res);
15834         CHECK_ACCESS(_res_ptr);
15835         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15836         FREE(untag_ptr(_res));
15837         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15838 }
15839
15840 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15841         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15842         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15843         return tag_ptr(ret_conv, true);
15844 }
15845 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15846         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15847         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15848         return ret_conv;
15849 }
15850
15851 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15852         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15853         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15854         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15855         return tag_ptr(ret_conv, true);
15856 }
15857
15858 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15859         void* o_ptr = untag_ptr(o);
15860         CHECK_ACCESS(o_ptr);
15861         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15862         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
15863         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15864         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15865         return tag_ptr(ret_conv, true);
15866 }
15867
15868 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15869         void* e_ptr = untag_ptr(e);
15870         CHECK_ACCESS(e_ptr);
15871         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15872         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15873         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15874         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15875         return tag_ptr(ret_conv, true);
15876 }
15877
15878 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15879         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15880         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15881         return ret_conv;
15882 }
15883
15884 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15885         if (!ptr_is_owned(_res)) return;
15886         void* _res_ptr = untag_ptr(_res);
15887         CHECK_ACCESS(_res_ptr);
15888         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15889         FREE(untag_ptr(_res));
15890         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15891 }
15892
15893 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15894         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15895         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15896         return tag_ptr(ret_conv, true);
15897 }
15898 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15899         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15900         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15901         return ret_conv;
15902 }
15903
15904 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15905         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15906         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15907         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15908         return tag_ptr(ret_conv, true);
15909 }
15910
15911 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
15912         LDKCVec_SpendableOutputDescriptorZ _res_constr;
15913         _res_constr.datalen = _res->arr_len;
15914         if (_res_constr.datalen > 0)
15915                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15916         else
15917                 _res_constr.data = NULL;
15918         uint64_t* _res_vals = _res->elems;
15919         for (size_t b = 0; b < _res_constr.datalen; b++) {
15920                 uint64_t _res_conv_27 = _res_vals[b];
15921                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
15922                 CHECK_ACCESS(_res_conv_27_ptr);
15923                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15924                 FREE(untag_ptr(_res_conv_27));
15925                 _res_constr.data[b] = _res_conv_27_conv;
15926         }
15927         FREE(_res);
15928         CVec_SpendableOutputDescriptorZ_free(_res_constr);
15929 }
15930
15931 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
15932         LDKCVec_TxOutZ _res_constr;
15933         _res_constr.datalen = _res->arr_len;
15934         if (_res_constr.datalen > 0)
15935                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15936         else
15937                 _res_constr.data = NULL;
15938         uint64_t* _res_vals = _res->elems;
15939         for (size_t h = 0; h < _res_constr.datalen; h++) {
15940                 uint64_t _res_conv_7 = _res_vals[h];
15941                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
15942                 CHECK_ACCESS(_res_conv_7_ptr);
15943                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15944                 FREE(untag_ptr(_res_conv_7));
15945                 _res_constr.data[h] = _res_conv_7_conv;
15946         }
15947         FREE(_res);
15948         CVec_TxOutZ_free(_res_constr);
15949 }
15950
15951 uint64_t  __attribute__((export_name("TS_COption_PackedLockTimeZ_some"))) TS_COption_PackedLockTimeZ_some(int32_t o) {
15952         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
15953         *ret_copy = COption_PackedLockTimeZ_some(o);
15954         uint64_t ret_ref = tag_ptr(ret_copy, true);
15955         return ret_ref;
15956 }
15957
15958 uint64_t  __attribute__((export_name("TS_COption_PackedLockTimeZ_none"))) TS_COption_PackedLockTimeZ_none() {
15959         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
15960         *ret_copy = COption_PackedLockTimeZ_none();
15961         uint64_t ret_ref = tag_ptr(ret_copy, true);
15962         return ret_ref;
15963 }
15964
15965 void  __attribute__((export_name("TS_COption_PackedLockTimeZ_free"))) TS_COption_PackedLockTimeZ_free(uint64_t _res) {
15966         if (!ptr_is_owned(_res)) return;
15967         void* _res_ptr = untag_ptr(_res);
15968         CHECK_ACCESS(_res_ptr);
15969         LDKCOption_PackedLockTimeZ _res_conv = *(LDKCOption_PackedLockTimeZ*)(_res_ptr);
15970         FREE(untag_ptr(_res));
15971         COption_PackedLockTimeZ_free(_res_conv);
15972 }
15973
15974 static inline uint64_t COption_PackedLockTimeZ_clone_ptr(LDKCOption_PackedLockTimeZ *NONNULL_PTR arg) {
15975         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
15976         *ret_copy = COption_PackedLockTimeZ_clone(arg);
15977         uint64_t ret_ref = tag_ptr(ret_copy, true);
15978         return ret_ref;
15979 }
15980 int64_t  __attribute__((export_name("TS_COption_PackedLockTimeZ_clone_ptr"))) TS_COption_PackedLockTimeZ_clone_ptr(uint64_t arg) {
15981         LDKCOption_PackedLockTimeZ* arg_conv = (LDKCOption_PackedLockTimeZ*)untag_ptr(arg);
15982         int64_t ret_conv = COption_PackedLockTimeZ_clone_ptr(arg_conv);
15983         return ret_conv;
15984 }
15985
15986 uint64_t  __attribute__((export_name("TS_COption_PackedLockTimeZ_clone"))) TS_COption_PackedLockTimeZ_clone(uint64_t orig) {
15987         LDKCOption_PackedLockTimeZ* orig_conv = (LDKCOption_PackedLockTimeZ*)untag_ptr(orig);
15988         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
15989         *ret_copy = COption_PackedLockTimeZ_clone(orig_conv);
15990         uint64_t ret_ref = tag_ptr(ret_copy, true);
15991         return ret_ref;
15992 }
15993
15994 static inline uint64_t C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR arg) {
15995         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
15996         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone(arg);
15997         return tag_ptr(ret_conv, true);
15998 }
15999 int64_t  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(uint64_t arg) {
16000         LDKC2Tuple_PartiallySignedTransactionusizeZ* arg_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(arg);
16001         int64_t ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(arg_conv);
16002         return ret_conv;
16003 }
16004
16005 uint64_t  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_clone"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_clone(uint64_t orig) {
16006         LDKC2Tuple_PartiallySignedTransactionusizeZ* orig_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(orig);
16007         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
16008         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone(orig_conv);
16009         return tag_ptr(ret_conv, true);
16010 }
16011
16012 uint64_t  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_new"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_new(int8_tArray a, uint32_t b) {
16013         LDKCVec_u8Z a_ref;
16014         a_ref.datalen = a->arr_len;
16015         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
16016         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
16017         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
16018         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_new(a_ref, b);
16019         return tag_ptr(ret_conv, true);
16020 }
16021
16022 void  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_free"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_free(uint64_t _res) {
16023         if (!ptr_is_owned(_res)) return;
16024         void* _res_ptr = untag_ptr(_res);
16025         CHECK_ACCESS(_res_ptr);
16026         LDKC2Tuple_PartiallySignedTransactionusizeZ _res_conv = *(LDKC2Tuple_PartiallySignedTransactionusizeZ*)(_res_ptr);
16027         FREE(untag_ptr(_res));
16028         C2Tuple_PartiallySignedTransactionusizeZ_free(_res_conv);
16029 }
16030
16031 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(uint64_t o) {
16032         void* o_ptr = untag_ptr(o);
16033         CHECK_ACCESS(o_ptr);
16034         LDKC2Tuple_PartiallySignedTransactionusizeZ o_conv = *(LDKC2Tuple_PartiallySignedTransactionusizeZ*)(o_ptr);
16035         o_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone((LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(o));
16036         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
16037         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(o_conv);
16038         return tag_ptr(ret_conv, true);
16039 }
16040
16041 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err() {
16042         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
16043         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err();
16044         return tag_ptr(ret_conv, true);
16045 }
16046
16047 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(uint64_t o) {
16048         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(o);
16049         jboolean ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(o_conv);
16050         return ret_conv;
16051 }
16052
16053 void  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(uint64_t _res) {
16054         if (!ptr_is_owned(_res)) return;
16055         void* _res_ptr = untag_ptr(_res);
16056         CHECK_ACCESS(_res_ptr);
16057         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)(_res_ptr);
16058         FREE(untag_ptr(_res));
16059         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(_res_conv);
16060 }
16061
16062 static inline uint64_t CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR arg) {
16063         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
16064         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(arg);
16065         return tag_ptr(ret_conv, true);
16066 }
16067 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(uint64_t arg) {
16068         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(arg);
16069         int64_t ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(arg_conv);
16070         return ret_conv;
16071 }
16072
16073 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(uint64_t orig) {
16074         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(orig);
16075         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
16076         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(orig_conv);
16077         return tag_ptr(ret_conv, true);
16078 }
16079
16080 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
16081         LDKCVec_PaymentPreimageZ _res_constr;
16082         _res_constr.datalen = _res->arr_len;
16083         if (_res_constr.datalen > 0)
16084                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
16085         else
16086                 _res_constr.data = NULL;
16087         int8_tArray* _res_vals = (void*) _res->elems;
16088         for (size_t m = 0; m < _res_constr.datalen; m++) {
16089                 int8_tArray _res_conv_12 = _res_vals[m];
16090                 LDKThirtyTwoBytes _res_conv_12_ref;
16091                 CHECK(_res_conv_12->arr_len == 32);
16092                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16093                 _res_constr.data[m] = _res_conv_12_ref;
16094         }
16095         FREE(_res);
16096         CVec_PaymentPreimageZ_free(_res_constr);
16097 }
16098
16099 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
16100         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16101         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
16102         return tag_ptr(ret_conv, true);
16103 }
16104 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
16105         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
16106         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
16107         return ret_conv;
16108 }
16109
16110 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
16111         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
16112         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16113         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
16114         return tag_ptr(ret_conv, true);
16115 }
16116
16117 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
16118         LDKSignature a_ref;
16119         CHECK(a->arr_len == 64);
16120         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
16121         LDKCVec_SignatureZ b_constr;
16122         b_constr.datalen = b->arr_len;
16123         if (b_constr.datalen > 0)
16124                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16125         else
16126                 b_constr.data = NULL;
16127         int8_tArray* b_vals = (void*) b->elems;
16128         for (size_t m = 0; m < b_constr.datalen; m++) {
16129                 int8_tArray b_conv_12 = b_vals[m];
16130                 LDKSignature b_conv_12_ref;
16131                 CHECK(b_conv_12->arr_len == 64);
16132                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
16133                 b_constr.data[m] = b_conv_12_ref;
16134         }
16135         FREE(b);
16136         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16137         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
16138         return tag_ptr(ret_conv, true);
16139 }
16140
16141 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
16142         if (!ptr_is_owned(_res)) return;
16143         void* _res_ptr = untag_ptr(_res);
16144         CHECK_ACCESS(_res_ptr);
16145         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
16146         FREE(untag_ptr(_res));
16147         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
16148 }
16149
16150 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
16151         void* o_ptr = untag_ptr(o);
16152         CHECK_ACCESS(o_ptr);
16153         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
16154         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
16155         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16156         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
16157         return tag_ptr(ret_conv, true);
16158 }
16159
16160 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
16161         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16162         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
16163         return tag_ptr(ret_conv, true);
16164 }
16165
16166 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
16167         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
16168         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
16169         return ret_conv;
16170 }
16171
16172 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
16173         if (!ptr_is_owned(_res)) return;
16174         void* _res_ptr = untag_ptr(_res);
16175         CHECK_ACCESS(_res_ptr);
16176         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
16177         FREE(untag_ptr(_res));
16178         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
16179 }
16180
16181 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
16182         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16183         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
16184         return tag_ptr(ret_conv, true);
16185 }
16186 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
16187         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
16188         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
16189         return ret_conv;
16190 }
16191
16192 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
16193         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
16194         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16195         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
16196         return tag_ptr(ret_conv, true);
16197 }
16198
16199 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
16200         LDKSignature o_ref;
16201         CHECK(o->arr_len == 64);
16202         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16203         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16204         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
16205         return tag_ptr(ret_conv, true);
16206 }
16207
16208 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
16209         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16210         *ret_conv = CResult_SignatureNoneZ_err();
16211         return tag_ptr(ret_conv, true);
16212 }
16213
16214 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
16215         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
16216         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
16217         return ret_conv;
16218 }
16219
16220 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
16221         if (!ptr_is_owned(_res)) return;
16222         void* _res_ptr = untag_ptr(_res);
16223         CHECK_ACCESS(_res_ptr);
16224         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
16225         FREE(untag_ptr(_res));
16226         CResult_SignatureNoneZ_free(_res_conv);
16227 }
16228
16229 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
16230         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16231         *ret_conv = CResult_SignatureNoneZ_clone(arg);
16232         return tag_ptr(ret_conv, true);
16233 }
16234 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
16235         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
16236         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
16237         return ret_conv;
16238 }
16239
16240 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
16241         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
16242         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16243         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
16244         return tag_ptr(ret_conv, true);
16245 }
16246
16247 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
16248         LDKPublicKey o_ref;
16249         CHECK(o->arr_len == 33);
16250         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
16251         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16252         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
16253         return tag_ptr(ret_conv, true);
16254 }
16255
16256 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
16257         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16258         *ret_conv = CResult_PublicKeyNoneZ_err();
16259         return tag_ptr(ret_conv, true);
16260 }
16261
16262 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
16263         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
16264         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
16265         return ret_conv;
16266 }
16267
16268 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
16269         if (!ptr_is_owned(_res)) return;
16270         void* _res_ptr = untag_ptr(_res);
16271         CHECK_ACCESS(_res_ptr);
16272         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
16273         FREE(untag_ptr(_res));
16274         CResult_PublicKeyNoneZ_free(_res_conv);
16275 }
16276
16277 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
16278         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16279         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
16280         return tag_ptr(ret_conv, true);
16281 }
16282 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
16283         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
16284         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
16285         return ret_conv;
16286 }
16287
16288 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16289         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16290         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16291         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16292         return tag_ptr(ret_conv, true);
16293 }
16294
16295 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
16296         void* o_ptr = untag_ptr(o);
16297         CHECK_ACCESS(o_ptr);
16298         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16299         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16300         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16301         *ret_copy = COption_ScalarZ_some(o_conv);
16302         uint64_t ret_ref = tag_ptr(ret_copy, true);
16303         return ret_ref;
16304 }
16305
16306 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
16307         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16308         *ret_copy = COption_ScalarZ_none();
16309         uint64_t ret_ref = tag_ptr(ret_copy, true);
16310         return ret_ref;
16311 }
16312
16313 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
16314         if (!ptr_is_owned(_res)) return;
16315         void* _res_ptr = untag_ptr(_res);
16316         CHECK_ACCESS(_res_ptr);
16317         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
16318         FREE(untag_ptr(_res));
16319         COption_ScalarZ_free(_res_conv);
16320 }
16321
16322 static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) {
16323         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16324         *ret_copy = COption_ScalarZ_clone(arg);
16325         uint64_t ret_ref = tag_ptr(ret_copy, true);
16326         return ret_ref;
16327 }
16328 int64_t  __attribute__((export_name("TS_COption_ScalarZ_clone_ptr"))) TS_COption_ScalarZ_clone_ptr(uint64_t arg) {
16329         LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg);
16330         int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv);
16331         return ret_conv;
16332 }
16333
16334 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_clone"))) TS_COption_ScalarZ_clone(uint64_t orig) {
16335         LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig);
16336         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16337         *ret_copy = COption_ScalarZ_clone(orig_conv);
16338         uint64_t ret_ref = tag_ptr(ret_copy, true);
16339         return ret_ref;
16340 }
16341
16342 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
16343         LDKThirtyTwoBytes o_ref;
16344         CHECK(o->arr_len == 32);
16345         memcpy(o_ref.data, o->elems, 32); FREE(o);
16346         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16347         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
16348         return tag_ptr(ret_conv, true);
16349 }
16350
16351 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
16352         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16353         *ret_conv = CResult_SharedSecretNoneZ_err();
16354         return tag_ptr(ret_conv, true);
16355 }
16356
16357 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
16358         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
16359         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
16360         return ret_conv;
16361 }
16362
16363 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
16364         if (!ptr_is_owned(_res)) return;
16365         void* _res_ptr = untag_ptr(_res);
16366         CHECK_ACCESS(_res_ptr);
16367         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16368         FREE(untag_ptr(_res));
16369         CResult_SharedSecretNoneZ_free(_res_conv);
16370 }
16371
16372 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16373         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16374         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16375         return tag_ptr(ret_conv, true);
16376 }
16377 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16378         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16379         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16380         return ret_conv;
16381 }
16382
16383 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16384         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16385         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16386         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16387         return tag_ptr(ret_conv, true);
16388 }
16389
16390 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16391         LDKCVec_U5Z _res_constr;
16392         _res_constr.datalen = _res->arr_len;
16393         if (_res_constr.datalen > 0)
16394                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16395         else
16396                 _res_constr.data = NULL;
16397         int8_t* _res_vals = (void*) _res->elems;
16398         for (size_t h = 0; h < _res_constr.datalen; h++) {
16399                 int8_t _res_conv_7 = _res_vals[h];
16400                 
16401                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16402         }
16403         FREE(_res);
16404         CVec_U5Z_free(_res_constr);
16405 }
16406
16407 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16408         LDKRecoverableSignature o_ref;
16409         CHECK(o->arr_len == 68);
16410         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16411         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16412         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16413         return tag_ptr(ret_conv, true);
16414 }
16415
16416 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16417         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16418         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16419         return tag_ptr(ret_conv, true);
16420 }
16421
16422 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16423         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16424         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16425         return ret_conv;
16426 }
16427
16428 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16429         if (!ptr_is_owned(_res)) return;
16430         void* _res_ptr = untag_ptr(_res);
16431         CHECK_ACCESS(_res_ptr);
16432         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16433         FREE(untag_ptr(_res));
16434         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16435 }
16436
16437 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16438         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16439         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16440         return tag_ptr(ret_conv, true);
16441 }
16442 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16443         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16444         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16445         return ret_conv;
16446 }
16447
16448 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16449         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16450         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16451         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16452         return tag_ptr(ret_conv, true);
16453 }
16454
16455 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16456         void* o_ptr = untag_ptr(o);
16457         CHECK_ACCESS(o_ptr);
16458         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16459         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16460                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16461                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16462         }
16463         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16464         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16465         return tag_ptr(ret_conv, true);
16466 }
16467
16468 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16469         void* e_ptr = untag_ptr(e);
16470         CHECK_ACCESS(e_ptr);
16471         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16472         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16473         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16474         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16475         return tag_ptr(ret_conv, true);
16476 }
16477
16478 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16479         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16480         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16481         return ret_conv;
16482 }
16483
16484 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16485         if (!ptr_is_owned(_res)) return;
16486         void* _res_ptr = untag_ptr(_res);
16487         CHECK_ACCESS(_res_ptr);
16488         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16489         FREE(untag_ptr(_res));
16490         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16491 }
16492
16493 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16494         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16495         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16496         return tag_ptr(ret_conv, true);
16497 }
16498 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16499         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16500         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16501         return ret_conv;
16502 }
16503
16504 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16505         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16506         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16507         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16508         return tag_ptr(ret_conv, true);
16509 }
16510
16511 uint64_t  __attribute__((export_name("TS_CResult_ScriptNoneZ_ok"))) TS_CResult_ScriptNoneZ_ok(int8_tArray o) {
16512         LDKCVec_u8Z o_ref;
16513         o_ref.datalen = o->arr_len;
16514         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16515         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16516         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
16517         *ret_conv = CResult_ScriptNoneZ_ok(o_ref);
16518         return tag_ptr(ret_conv, true);
16519 }
16520
16521 uint64_t  __attribute__((export_name("TS_CResult_ScriptNoneZ_err"))) TS_CResult_ScriptNoneZ_err() {
16522         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
16523         *ret_conv = CResult_ScriptNoneZ_err();
16524         return tag_ptr(ret_conv, true);
16525 }
16526
16527 jboolean  __attribute__((export_name("TS_CResult_ScriptNoneZ_is_ok"))) TS_CResult_ScriptNoneZ_is_ok(uint64_t o) {
16528         LDKCResult_ScriptNoneZ* o_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(o);
16529         jboolean ret_conv = CResult_ScriptNoneZ_is_ok(o_conv);
16530         return ret_conv;
16531 }
16532
16533 void  __attribute__((export_name("TS_CResult_ScriptNoneZ_free"))) TS_CResult_ScriptNoneZ_free(uint64_t _res) {
16534         if (!ptr_is_owned(_res)) return;
16535         void* _res_ptr = untag_ptr(_res);
16536         CHECK_ACCESS(_res_ptr);
16537         LDKCResult_ScriptNoneZ _res_conv = *(LDKCResult_ScriptNoneZ*)(_res_ptr);
16538         FREE(untag_ptr(_res));
16539         CResult_ScriptNoneZ_free(_res_conv);
16540 }
16541
16542 static inline uint64_t CResult_ScriptNoneZ_clone_ptr(LDKCResult_ScriptNoneZ *NONNULL_PTR arg) {
16543         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
16544         *ret_conv = CResult_ScriptNoneZ_clone(arg);
16545         return tag_ptr(ret_conv, true);
16546 }
16547 int64_t  __attribute__((export_name("TS_CResult_ScriptNoneZ_clone_ptr"))) TS_CResult_ScriptNoneZ_clone_ptr(uint64_t arg) {
16548         LDKCResult_ScriptNoneZ* arg_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(arg);
16549         int64_t ret_conv = CResult_ScriptNoneZ_clone_ptr(arg_conv);
16550         return ret_conv;
16551 }
16552
16553 uint64_t  __attribute__((export_name("TS_CResult_ScriptNoneZ_clone"))) TS_CResult_ScriptNoneZ_clone(uint64_t orig) {
16554         LDKCResult_ScriptNoneZ* orig_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(orig);
16555         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
16556         *ret_conv = CResult_ScriptNoneZ_clone(orig_conv);
16557         return tag_ptr(ret_conv, true);
16558 }
16559
16560 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
16561         LDKShutdownScript o_conv;
16562         o_conv.inner = untag_ptr(o);
16563         o_conv.is_owned = ptr_is_owned(o);
16564         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16565         o_conv = ShutdownScript_clone(&o_conv);
16566         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16567         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
16568         return tag_ptr(ret_conv, true);
16569 }
16570
16571 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
16572         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16573         *ret_conv = CResult_ShutdownScriptNoneZ_err();
16574         return tag_ptr(ret_conv, true);
16575 }
16576
16577 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
16578         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
16579         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
16580         return ret_conv;
16581 }
16582
16583 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
16584         if (!ptr_is_owned(_res)) return;
16585         void* _res_ptr = untag_ptr(_res);
16586         CHECK_ACCESS(_res_ptr);
16587         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
16588         FREE(untag_ptr(_res));
16589         CResult_ShutdownScriptNoneZ_free(_res_conv);
16590 }
16591
16592 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
16593         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16594         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
16595         return tag_ptr(ret_conv, true);
16596 }
16597 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
16598         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
16599         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
16600         return ret_conv;
16601 }
16602
16603 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
16604         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
16605         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16606         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
16607         return tag_ptr(ret_conv, true);
16608 }
16609
16610 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16611         LDKCVec_CVec_u8ZZ _res_constr;
16612         _res_constr.datalen = _res->arr_len;
16613         if (_res_constr.datalen > 0)
16614                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16615         else
16616                 _res_constr.data = NULL;
16617         int8_tArray* _res_vals = (void*) _res->elems;
16618         for (size_t m = 0; m < _res_constr.datalen; m++) {
16619                 int8_tArray _res_conv_12 = _res_vals[m];
16620                 LDKCVec_u8Z _res_conv_12_ref;
16621                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16622                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16623                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16624                 _res_constr.data[m] = _res_conv_12_ref;
16625         }
16626         FREE(_res);
16627         CVec_CVec_u8ZZ_free(_res_constr);
16628 }
16629
16630 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16631         LDKCVec_CVec_u8ZZ o_constr;
16632         o_constr.datalen = o->arr_len;
16633         if (o_constr.datalen > 0)
16634                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16635         else
16636                 o_constr.data = NULL;
16637         int8_tArray* o_vals = (void*) o->elems;
16638         for (size_t m = 0; m < o_constr.datalen; m++) {
16639                 int8_tArray o_conv_12 = o_vals[m];
16640                 LDKCVec_u8Z o_conv_12_ref;
16641                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16642                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16643                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16644                 o_constr.data[m] = o_conv_12_ref;
16645         }
16646         FREE(o);
16647         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16648         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16649         return tag_ptr(ret_conv, true);
16650 }
16651
16652 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16653         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16654         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16655         return tag_ptr(ret_conv, true);
16656 }
16657
16658 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16659         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16660         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16661         return ret_conv;
16662 }
16663
16664 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16665         if (!ptr_is_owned(_res)) return;
16666         void* _res_ptr = untag_ptr(_res);
16667         CHECK_ACCESS(_res_ptr);
16668         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16669         FREE(untag_ptr(_res));
16670         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16671 }
16672
16673 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16674         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16675         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16676         return tag_ptr(ret_conv, true);
16677 }
16678 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16679         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16680         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16681         return ret_conv;
16682 }
16683
16684 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16685         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16686         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16687         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16688         return tag_ptr(ret_conv, true);
16689 }
16690
16691 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16692         LDKInMemorySigner o_conv;
16693         o_conv.inner = untag_ptr(o);
16694         o_conv.is_owned = ptr_is_owned(o);
16695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16696         o_conv = InMemorySigner_clone(&o_conv);
16697         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16698         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16699         return tag_ptr(ret_conv, true);
16700 }
16701
16702 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16703         void* e_ptr = untag_ptr(e);
16704         CHECK_ACCESS(e_ptr);
16705         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16706         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16707         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16708         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16709         return tag_ptr(ret_conv, true);
16710 }
16711
16712 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16713         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16714         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16715         return ret_conv;
16716 }
16717
16718 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16719         if (!ptr_is_owned(_res)) return;
16720         void* _res_ptr = untag_ptr(_res);
16721         CHECK_ACCESS(_res_ptr);
16722         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16723         FREE(untag_ptr(_res));
16724         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16725 }
16726
16727 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16728         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16729         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16730         return tag_ptr(ret_conv, true);
16731 }
16732 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16733         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16734         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16735         return ret_conv;
16736 }
16737
16738 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16739         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16740         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16741         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16742         return tag_ptr(ret_conv, true);
16743 }
16744
16745 uint64_t  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_ok"))) TS_CResult_PartiallySignedTransactionNoneZ_ok(int8_tArray o) {
16746         LDKCVec_u8Z o_ref;
16747         o_ref.datalen = o->arr_len;
16748         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16749         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16750         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
16751         *ret_conv = CResult_PartiallySignedTransactionNoneZ_ok(o_ref);
16752         return tag_ptr(ret_conv, true);
16753 }
16754
16755 uint64_t  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_err"))) TS_CResult_PartiallySignedTransactionNoneZ_err() {
16756         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
16757         *ret_conv = CResult_PartiallySignedTransactionNoneZ_err();
16758         return tag_ptr(ret_conv, true);
16759 }
16760
16761 jboolean  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_is_ok"))) TS_CResult_PartiallySignedTransactionNoneZ_is_ok(uint64_t o) {
16762         LDKCResult_PartiallySignedTransactionNoneZ* o_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(o);
16763         jboolean ret_conv = CResult_PartiallySignedTransactionNoneZ_is_ok(o_conv);
16764         return ret_conv;
16765 }
16766
16767 void  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_free"))) TS_CResult_PartiallySignedTransactionNoneZ_free(uint64_t _res) {
16768         if (!ptr_is_owned(_res)) return;
16769         void* _res_ptr = untag_ptr(_res);
16770         CHECK_ACCESS(_res_ptr);
16771         LDKCResult_PartiallySignedTransactionNoneZ _res_conv = *(LDKCResult_PartiallySignedTransactionNoneZ*)(_res_ptr);
16772         FREE(untag_ptr(_res));
16773         CResult_PartiallySignedTransactionNoneZ_free(_res_conv);
16774 }
16775
16776 static inline uint64_t CResult_PartiallySignedTransactionNoneZ_clone_ptr(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR arg) {
16777         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
16778         *ret_conv = CResult_PartiallySignedTransactionNoneZ_clone(arg);
16779         return tag_ptr(ret_conv, true);
16780 }
16781 int64_t  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_clone_ptr"))) TS_CResult_PartiallySignedTransactionNoneZ_clone_ptr(uint64_t arg) {
16782         LDKCResult_PartiallySignedTransactionNoneZ* arg_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(arg);
16783         int64_t ret_conv = CResult_PartiallySignedTransactionNoneZ_clone_ptr(arg_conv);
16784         return ret_conv;
16785 }
16786
16787 uint64_t  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_clone"))) TS_CResult_PartiallySignedTransactionNoneZ_clone(uint64_t orig) {
16788         LDKCResult_PartiallySignedTransactionNoneZ* orig_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(orig);
16789         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
16790         *ret_conv = CResult_PartiallySignedTransactionNoneZ_clone(orig_conv);
16791         return tag_ptr(ret_conv, true);
16792 }
16793
16794 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16795         LDKTransaction o_ref;
16796         o_ref.datalen = o->arr_len;
16797         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16798         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16799         o_ref.data_is_owned = true;
16800         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16801         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16802         return tag_ptr(ret_conv, true);
16803 }
16804
16805 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16806         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16807         *ret_conv = CResult_TransactionNoneZ_err();
16808         return tag_ptr(ret_conv, true);
16809 }
16810
16811 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16812         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16813         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16814         return ret_conv;
16815 }
16816
16817 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16818         if (!ptr_is_owned(_res)) return;
16819         void* _res_ptr = untag_ptr(_res);
16820         CHECK_ACCESS(_res_ptr);
16821         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16822         FREE(untag_ptr(_res));
16823         CResult_TransactionNoneZ_free(_res_conv);
16824 }
16825
16826 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16827         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16828         *ret_conv = CResult_TransactionNoneZ_clone(arg);
16829         return tag_ptr(ret_conv, true);
16830 }
16831 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
16832         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
16833         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16834         return ret_conv;
16835 }
16836
16837 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
16838         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
16839         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16840         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16841         return tag_ptr(ret_conv, true);
16842 }
16843
16844 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
16845         LDKCVec_ChannelDetailsZ _res_constr;
16846         _res_constr.datalen = _res->arr_len;
16847         if (_res_constr.datalen > 0)
16848                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16849         else
16850                 _res_constr.data = NULL;
16851         uint64_t* _res_vals = _res->elems;
16852         for (size_t q = 0; q < _res_constr.datalen; q++) {
16853                 uint64_t _res_conv_16 = _res_vals[q];
16854                 LDKChannelDetails _res_conv_16_conv;
16855                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
16856                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
16857                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16858                 _res_constr.data[q] = _res_conv_16_conv;
16859         }
16860         FREE(_res);
16861         CVec_ChannelDetailsZ_free(_res_constr);
16862 }
16863
16864 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
16865         LDKRoute o_conv;
16866         o_conv.inner = untag_ptr(o);
16867         o_conv.is_owned = ptr_is_owned(o);
16868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16869         o_conv = Route_clone(&o_conv);
16870         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16871         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
16872         return tag_ptr(ret_conv, true);
16873 }
16874
16875 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
16876         LDKLightningError e_conv;
16877         e_conv.inner = untag_ptr(e);
16878         e_conv.is_owned = ptr_is_owned(e);
16879         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16880         e_conv = LightningError_clone(&e_conv);
16881         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16882         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
16883         return tag_ptr(ret_conv, true);
16884 }
16885
16886 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
16887         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
16888         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
16889         return ret_conv;
16890 }
16891
16892 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
16893         if (!ptr_is_owned(_res)) return;
16894         void* _res_ptr = untag_ptr(_res);
16895         CHECK_ACCESS(_res_ptr);
16896         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
16897         FREE(untag_ptr(_res));
16898         CResult_RouteLightningErrorZ_free(_res_conv);
16899 }
16900
16901 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
16902         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16903         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
16904         return tag_ptr(ret_conv, true);
16905 }
16906 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
16907         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
16908         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
16909         return ret_conv;
16910 }
16911
16912 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
16913         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
16914         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16915         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
16916         return tag_ptr(ret_conv, true);
16917 }
16918
16919 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
16920         LDKInFlightHtlcs o_conv;
16921         o_conv.inner = untag_ptr(o);
16922         o_conv.is_owned = ptr_is_owned(o);
16923         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16924         o_conv = InFlightHtlcs_clone(&o_conv);
16925         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16926         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
16927         return tag_ptr(ret_conv, true);
16928 }
16929
16930 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
16931         void* e_ptr = untag_ptr(e);
16932         CHECK_ACCESS(e_ptr);
16933         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16934         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16935         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16936         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
16937         return tag_ptr(ret_conv, true);
16938 }
16939
16940 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
16941         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
16942         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
16943         return ret_conv;
16944 }
16945
16946 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
16947         if (!ptr_is_owned(_res)) return;
16948         void* _res_ptr = untag_ptr(_res);
16949         CHECK_ACCESS(_res_ptr);
16950         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
16951         FREE(untag_ptr(_res));
16952         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
16953 }
16954
16955 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
16956         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16957         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
16958         return tag_ptr(ret_conv, true);
16959 }
16960 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
16961         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
16962         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
16963         return ret_conv;
16964 }
16965
16966 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
16967         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
16968         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16969         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
16970         return tag_ptr(ret_conv, true);
16971 }
16972
16973 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
16974         LDKRouteHop o_conv;
16975         o_conv.inner = untag_ptr(o);
16976         o_conv.is_owned = ptr_is_owned(o);
16977         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16978         o_conv = RouteHop_clone(&o_conv);
16979         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
16980         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
16981         return tag_ptr(ret_conv, true);
16982 }
16983
16984 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
16985         void* e_ptr = untag_ptr(e);
16986         CHECK_ACCESS(e_ptr);
16987         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16988         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16989         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
16990         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
16991         return tag_ptr(ret_conv, true);
16992 }
16993
16994 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
16995         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
16996         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
16997         return ret_conv;
16998 }
16999
17000 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
17001         if (!ptr_is_owned(_res)) return;
17002         void* _res_ptr = untag_ptr(_res);
17003         CHECK_ACCESS(_res_ptr);
17004         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
17005         FREE(untag_ptr(_res));
17006         CResult_RouteHopDecodeErrorZ_free(_res_conv);
17007 }
17008
17009 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
17010         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17011         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
17012         return tag_ptr(ret_conv, true);
17013 }
17014 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17015         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
17016         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
17017         return ret_conv;
17018 }
17019
17020 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
17021         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
17022         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17023         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
17024         return tag_ptr(ret_conv, true);
17025 }
17026
17027 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
17028         LDKCVec_BlindedHopZ _res_constr;
17029         _res_constr.datalen = _res->arr_len;
17030         if (_res_constr.datalen > 0)
17031                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
17032         else
17033                 _res_constr.data = NULL;
17034         uint64_t* _res_vals = _res->elems;
17035         for (size_t m = 0; m < _res_constr.datalen; m++) {
17036                 uint64_t _res_conv_12 = _res_vals[m];
17037                 LDKBlindedHop _res_conv_12_conv;
17038                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
17039                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
17040                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
17041                 _res_constr.data[m] = _res_conv_12_conv;
17042         }
17043         FREE(_res);
17044         CVec_BlindedHopZ_free(_res_constr);
17045 }
17046
17047 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
17048         LDKBlindedTail o_conv;
17049         o_conv.inner = untag_ptr(o);
17050         o_conv.is_owned = ptr_is_owned(o);
17051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17052         o_conv = BlindedTail_clone(&o_conv);
17053         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17054         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
17055         return tag_ptr(ret_conv, true);
17056 }
17057
17058 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
17059         void* e_ptr = untag_ptr(e);
17060         CHECK_ACCESS(e_ptr);
17061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17063         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17064         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
17065         return tag_ptr(ret_conv, true);
17066 }
17067
17068 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
17069         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
17070         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
17071         return ret_conv;
17072 }
17073
17074 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
17075         if (!ptr_is_owned(_res)) return;
17076         void* _res_ptr = untag_ptr(_res);
17077         CHECK_ACCESS(_res_ptr);
17078         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
17079         FREE(untag_ptr(_res));
17080         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
17081 }
17082
17083 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
17084         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17085         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
17086         return tag_ptr(ret_conv, true);
17087 }
17088 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
17089         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
17090         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
17091         return ret_conv;
17092 }
17093
17094 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
17095         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
17096         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17097         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
17098         return tag_ptr(ret_conv, true);
17099 }
17100
17101 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
17102         LDKCVec_RouteHopZ _res_constr;
17103         _res_constr.datalen = _res->arr_len;
17104         if (_res_constr.datalen > 0)
17105                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17106         else
17107                 _res_constr.data = NULL;
17108         uint64_t* _res_vals = _res->elems;
17109         for (size_t k = 0; k < _res_constr.datalen; k++) {
17110                 uint64_t _res_conv_10 = _res_vals[k];
17111                 LDKRouteHop _res_conv_10_conv;
17112                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
17113                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
17114                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
17115                 _res_constr.data[k] = _res_conv_10_conv;
17116         }
17117         FREE(_res);
17118         CVec_RouteHopZ_free(_res_constr);
17119 }
17120
17121 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
17122         LDKCVec_PathZ _res_constr;
17123         _res_constr.datalen = _res->arr_len;
17124         if (_res_constr.datalen > 0)
17125                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
17126         else
17127                 _res_constr.data = NULL;
17128         uint64_t* _res_vals = _res->elems;
17129         for (size_t g = 0; g < _res_constr.datalen; g++) {
17130                 uint64_t _res_conv_6 = _res_vals[g];
17131                 LDKPath _res_conv_6_conv;
17132                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
17133                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
17134                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
17135                 _res_constr.data[g] = _res_conv_6_conv;
17136         }
17137         FREE(_res);
17138         CVec_PathZ_free(_res_constr);
17139 }
17140
17141 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
17142         LDKRoute o_conv;
17143         o_conv.inner = untag_ptr(o);
17144         o_conv.is_owned = ptr_is_owned(o);
17145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17146         o_conv = Route_clone(&o_conv);
17147         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17148         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
17149         return tag_ptr(ret_conv, true);
17150 }
17151
17152 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
17153         void* e_ptr = untag_ptr(e);
17154         CHECK_ACCESS(e_ptr);
17155         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17156         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17157         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17158         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
17159         return tag_ptr(ret_conv, true);
17160 }
17161
17162 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
17163         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
17164         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
17165         return ret_conv;
17166 }
17167
17168 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
17169         if (!ptr_is_owned(_res)) return;
17170         void* _res_ptr = untag_ptr(_res);
17171         CHECK_ACCESS(_res_ptr);
17172         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
17173         FREE(untag_ptr(_res));
17174         CResult_RouteDecodeErrorZ_free(_res_conv);
17175 }
17176
17177 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
17178         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17179         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
17180         return tag_ptr(ret_conv, true);
17181 }
17182 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
17183         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
17184         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
17185         return ret_conv;
17186 }
17187
17188 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
17189         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
17190         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17191         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
17192         return tag_ptr(ret_conv, true);
17193 }
17194
17195 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
17196         LDKRouteParameters o_conv;
17197         o_conv.inner = untag_ptr(o);
17198         o_conv.is_owned = ptr_is_owned(o);
17199         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17200         o_conv = RouteParameters_clone(&o_conv);
17201         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17202         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
17203         return tag_ptr(ret_conv, true);
17204 }
17205
17206 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
17207         void* e_ptr = untag_ptr(e);
17208         CHECK_ACCESS(e_ptr);
17209         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17210         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17211         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17212         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
17213         return tag_ptr(ret_conv, true);
17214 }
17215
17216 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
17217         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
17218         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
17219         return ret_conv;
17220 }
17221
17222 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
17223         if (!ptr_is_owned(_res)) return;
17224         void* _res_ptr = untag_ptr(_res);
17225         CHECK_ACCESS(_res_ptr);
17226         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
17227         FREE(untag_ptr(_res));
17228         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
17229 }
17230
17231 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
17232         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17233         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
17234         return tag_ptr(ret_conv, true);
17235 }
17236 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17237         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
17238         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
17239         return ret_conv;
17240 }
17241
17242 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
17243         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
17244         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17245         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
17246         return tag_ptr(ret_conv, true);
17247 }
17248
17249 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
17250         LDKCVec_u64Z _res_constr;
17251         _res_constr.datalen = _res->arr_len;
17252         if (_res_constr.datalen > 0)
17253                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17254         else
17255                 _res_constr.data = NULL;
17256         int64_t* _res_vals = _res->elems;
17257         for (size_t i = 0; i < _res_constr.datalen; i++) {
17258                 int64_t _res_conv_8 = _res_vals[i];
17259                 _res_constr.data[i] = _res_conv_8;
17260         }
17261         FREE(_res);
17262         CVec_u64Z_free(_res_constr);
17263 }
17264
17265 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
17266         LDKPaymentParameters o_conv;
17267         o_conv.inner = untag_ptr(o);
17268         o_conv.is_owned = ptr_is_owned(o);
17269         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17270         o_conv = PaymentParameters_clone(&o_conv);
17271         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17272         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
17273         return tag_ptr(ret_conv, true);
17274 }
17275
17276 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
17277         void* e_ptr = untag_ptr(e);
17278         CHECK_ACCESS(e_ptr);
17279         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17280         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17281         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17282         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
17283         return tag_ptr(ret_conv, true);
17284 }
17285
17286 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
17287         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
17288         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
17289         return ret_conv;
17290 }
17291
17292 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
17293         if (!ptr_is_owned(_res)) return;
17294         void* _res_ptr = untag_ptr(_res);
17295         CHECK_ACCESS(_res_ptr);
17296         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
17297         FREE(untag_ptr(_res));
17298         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
17299 }
17300
17301 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
17302         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17303         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
17304         return tag_ptr(ret_conv, true);
17305 }
17306 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17307         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
17308         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
17309         return ret_conv;
17310 }
17311
17312 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
17313         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
17314         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17315         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
17316         return tag_ptr(ret_conv, true);
17317 }
17318
17319 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
17320         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17321         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
17322         return tag_ptr(ret_conv, true);
17323 }
17324 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
17325         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
17326         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
17327         return ret_conv;
17328 }
17329
17330 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
17331         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
17332         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17333         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
17334         return tag_ptr(ret_conv, true);
17335 }
17336
17337 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
17338         LDKBlindedPayInfo a_conv;
17339         a_conv.inner = untag_ptr(a);
17340         a_conv.is_owned = ptr_is_owned(a);
17341         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17342         a_conv = BlindedPayInfo_clone(&a_conv);
17343         LDKBlindedPath b_conv;
17344         b_conv.inner = untag_ptr(b);
17345         b_conv.is_owned = ptr_is_owned(b);
17346         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17347         b_conv = BlindedPath_clone(&b_conv);
17348         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17349         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
17350         return tag_ptr(ret_conv, true);
17351 }
17352
17353 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
17354         if (!ptr_is_owned(_res)) return;
17355         void* _res_ptr = untag_ptr(_res);
17356         CHECK_ACCESS(_res_ptr);
17357         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
17358         FREE(untag_ptr(_res));
17359         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
17360 }
17361
17362 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
17363         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
17364         _res_constr.datalen = _res->arr_len;
17365         if (_res_constr.datalen > 0)
17366                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
17367         else
17368                 _res_constr.data = NULL;
17369         uint64_t* _res_vals = _res->elems;
17370         for (size_t l = 0; l < _res_constr.datalen; l++) {
17371                 uint64_t _res_conv_37 = _res_vals[l];
17372                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
17373                 CHECK_ACCESS(_res_conv_37_ptr);
17374                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
17375                 FREE(untag_ptr(_res_conv_37));
17376                 _res_constr.data[l] = _res_conv_37_conv;
17377         }
17378         FREE(_res);
17379         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
17380 }
17381
17382 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
17383         LDKCVec_RouteHintZ _res_constr;
17384         _res_constr.datalen = _res->arr_len;
17385         if (_res_constr.datalen > 0)
17386                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17387         else
17388                 _res_constr.data = NULL;
17389         uint64_t* _res_vals = _res->elems;
17390         for (size_t l = 0; l < _res_constr.datalen; l++) {
17391                 uint64_t _res_conv_11 = _res_vals[l];
17392                 LDKRouteHint _res_conv_11_conv;
17393                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
17394                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
17395                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
17396                 _res_constr.data[l] = _res_conv_11_conv;
17397         }
17398         FREE(_res);
17399         CVec_RouteHintZ_free(_res_constr);
17400 }
17401
17402 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
17403         LDKCVec_RouteHintHopZ _res_constr;
17404         _res_constr.datalen = _res->arr_len;
17405         if (_res_constr.datalen > 0)
17406                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
17407         else
17408                 _res_constr.data = NULL;
17409         uint64_t* _res_vals = _res->elems;
17410         for (size_t o = 0; o < _res_constr.datalen; o++) {
17411                 uint64_t _res_conv_14 = _res_vals[o];
17412                 LDKRouteHintHop _res_conv_14_conv;
17413                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17414                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17415                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17416                 _res_constr.data[o] = _res_conv_14_conv;
17417         }
17418         FREE(_res);
17419         CVec_RouteHintHopZ_free(_res_constr);
17420 }
17421
17422 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
17423         LDKRouteHint o_conv;
17424         o_conv.inner = untag_ptr(o);
17425         o_conv.is_owned = ptr_is_owned(o);
17426         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17427         o_conv = RouteHint_clone(&o_conv);
17428         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17429         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
17430         return tag_ptr(ret_conv, true);
17431 }
17432
17433 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
17434         void* e_ptr = untag_ptr(e);
17435         CHECK_ACCESS(e_ptr);
17436         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17437         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17438         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17439         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
17440         return tag_ptr(ret_conv, true);
17441 }
17442
17443 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
17444         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
17445         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
17446         return ret_conv;
17447 }
17448
17449 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
17450         if (!ptr_is_owned(_res)) return;
17451         void* _res_ptr = untag_ptr(_res);
17452         CHECK_ACCESS(_res_ptr);
17453         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
17454         FREE(untag_ptr(_res));
17455         CResult_RouteHintDecodeErrorZ_free(_res_conv);
17456 }
17457
17458 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
17459         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17460         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
17461         return tag_ptr(ret_conv, true);
17462 }
17463 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
17464         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
17465         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
17466         return ret_conv;
17467 }
17468
17469 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
17470         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
17471         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17472         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
17473         return tag_ptr(ret_conv, true);
17474 }
17475
17476 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
17477         LDKRouteHintHop o_conv;
17478         o_conv.inner = untag_ptr(o);
17479         o_conv.is_owned = ptr_is_owned(o);
17480         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17481         o_conv = RouteHintHop_clone(&o_conv);
17482         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17483         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
17484         return tag_ptr(ret_conv, true);
17485 }
17486
17487 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
17488         void* e_ptr = untag_ptr(e);
17489         CHECK_ACCESS(e_ptr);
17490         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17491         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17492         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17493         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
17494         return tag_ptr(ret_conv, true);
17495 }
17496
17497 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
17498         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
17499         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
17500         return ret_conv;
17501 }
17502
17503 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
17504         if (!ptr_is_owned(_res)) return;
17505         void* _res_ptr = untag_ptr(_res);
17506         CHECK_ACCESS(_res_ptr);
17507         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
17508         FREE(untag_ptr(_res));
17509         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
17510 }
17511
17512 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
17513         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17514         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
17515         return tag_ptr(ret_conv, true);
17516 }
17517 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17518         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
17519         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
17520         return ret_conv;
17521 }
17522
17523 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
17524         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
17525         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17526         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
17527         return tag_ptr(ret_conv, true);
17528 }
17529
17530 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
17531         LDKCVec_PublicKeyZ _res_constr;
17532         _res_constr.datalen = _res->arr_len;
17533         if (_res_constr.datalen > 0)
17534                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
17535         else
17536                 _res_constr.data = NULL;
17537         int8_tArray* _res_vals = (void*) _res->elems;
17538         for (size_t m = 0; m < _res_constr.datalen; m++) {
17539                 int8_tArray _res_conv_12 = _res_vals[m];
17540                 LDKPublicKey _res_conv_12_ref;
17541                 CHECK(_res_conv_12->arr_len == 33);
17542                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
17543                 _res_constr.data[m] = _res_conv_12_ref;
17544         }
17545         FREE(_res);
17546         CVec_PublicKeyZ_free(_res_constr);
17547 }
17548
17549 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17550         LDKCVec_TransactionZ _res_constr;
17551         _res_constr.datalen = _res->arr_len;
17552         if (_res_constr.datalen > 0)
17553                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
17554         else
17555                 _res_constr.data = NULL;
17556         int8_tArray* _res_vals = (void*) _res->elems;
17557         for (size_t m = 0; m < _res_constr.datalen; m++) {
17558                 int8_tArray _res_conv_12 = _res_vals[m];
17559                 LDKTransaction _res_conv_12_ref;
17560                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17561                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
17562                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17563                 _res_conv_12_ref.data_is_owned = true;
17564                 _res_constr.data[m] = _res_conv_12_ref;
17565         }
17566         FREE(_res);
17567         CVec_TransactionZ_free(_res_constr);
17568 }
17569
17570 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
17571         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17572         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
17573         return tag_ptr(ret_conv, true);
17574 }
17575 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
17576         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
17577         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
17578         return ret_conv;
17579 }
17580
17581 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
17582         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
17583         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17584         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
17585         return tag_ptr(ret_conv, true);
17586 }
17587
17588 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
17589         LDKTransaction b_ref;
17590         b_ref.datalen = b->arr_len;
17591         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
17592         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17593         b_ref.data_is_owned = true;
17594         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17595         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
17596         return tag_ptr(ret_conv, true);
17597 }
17598
17599 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
17600         if (!ptr_is_owned(_res)) return;
17601         void* _res_ptr = untag_ptr(_res);
17602         CHECK_ACCESS(_res_ptr);
17603         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
17604         FREE(untag_ptr(_res));
17605         C2Tuple_usizeTransactionZ_free(_res_conv);
17606 }
17607
17608 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
17609         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
17610         _res_constr.datalen = _res->arr_len;
17611         if (_res_constr.datalen > 0)
17612                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17613         else
17614                 _res_constr.data = NULL;
17615         uint64_t* _res_vals = _res->elems;
17616         for (size_t c = 0; c < _res_constr.datalen; c++) {
17617                 uint64_t _res_conv_28 = _res_vals[c];
17618                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
17619                 CHECK_ACCESS(_res_conv_28_ptr);
17620                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
17621                 FREE(untag_ptr(_res_conv_28));
17622                 _res_constr.data[c] = _res_conv_28_conv;
17623         }
17624         FREE(_res);
17625         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
17626 }
17627
17628 uint64_t  __attribute__((export_name("TS_COption_BlockHashZ_some"))) TS_COption_BlockHashZ_some(int8_tArray o) {
17629         LDKThirtyTwoBytes o_ref;
17630         CHECK(o->arr_len == 32);
17631         memcpy(o_ref.data, o->elems, 32); FREE(o);
17632         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
17633         *ret_copy = COption_BlockHashZ_some(o_ref);
17634         uint64_t ret_ref = tag_ptr(ret_copy, true);
17635         return ret_ref;
17636 }
17637
17638 uint64_t  __attribute__((export_name("TS_COption_BlockHashZ_none"))) TS_COption_BlockHashZ_none() {
17639         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
17640         *ret_copy = COption_BlockHashZ_none();
17641         uint64_t ret_ref = tag_ptr(ret_copy, true);
17642         return ret_ref;
17643 }
17644
17645 void  __attribute__((export_name("TS_COption_BlockHashZ_free"))) TS_COption_BlockHashZ_free(uint64_t _res) {
17646         if (!ptr_is_owned(_res)) return;
17647         void* _res_ptr = untag_ptr(_res);
17648         CHECK_ACCESS(_res_ptr);
17649         LDKCOption_BlockHashZ _res_conv = *(LDKCOption_BlockHashZ*)(_res_ptr);
17650         FREE(untag_ptr(_res));
17651         COption_BlockHashZ_free(_res_conv);
17652 }
17653
17654 static inline uint64_t COption_BlockHashZ_clone_ptr(LDKCOption_BlockHashZ *NONNULL_PTR arg) {
17655         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
17656         *ret_copy = COption_BlockHashZ_clone(arg);
17657         uint64_t ret_ref = tag_ptr(ret_copy, true);
17658         return ret_ref;
17659 }
17660 int64_t  __attribute__((export_name("TS_COption_BlockHashZ_clone_ptr"))) TS_COption_BlockHashZ_clone_ptr(uint64_t arg) {
17661         LDKCOption_BlockHashZ* arg_conv = (LDKCOption_BlockHashZ*)untag_ptr(arg);
17662         int64_t ret_conv = COption_BlockHashZ_clone_ptr(arg_conv);
17663         return ret_conv;
17664 }
17665
17666 uint64_t  __attribute__((export_name("TS_COption_BlockHashZ_clone"))) TS_COption_BlockHashZ_clone(uint64_t orig) {
17667         LDKCOption_BlockHashZ* orig_conv = (LDKCOption_BlockHashZ*)untag_ptr(orig);
17668         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
17669         *ret_copy = COption_BlockHashZ_clone(orig_conv);
17670         uint64_t ret_ref = tag_ptr(ret_copy, true);
17671         return ret_ref;
17672 }
17673
17674 static inline uint64_t C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR arg) {
17675         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
17676         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone(arg);
17677         return tag_ptr(ret_conv, true);
17678 }
17679 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_clone_ptr"))) TS_C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(uint64_t arg) {
17680         LDKC2Tuple_TxidCOption_BlockHashZZ* arg_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(arg);
17681         int64_t ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(arg_conv);
17682         return ret_conv;
17683 }
17684
17685 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_clone"))) TS_C2Tuple_TxidCOption_BlockHashZZ_clone(uint64_t orig) {
17686         LDKC2Tuple_TxidCOption_BlockHashZZ* orig_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(orig);
17687         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
17688         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone(orig_conv);
17689         return tag_ptr(ret_conv, true);
17690 }
17691
17692 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_new"))) TS_C2Tuple_TxidCOption_BlockHashZZ_new(int8_tArray a, uint64_t b) {
17693         LDKThirtyTwoBytes a_ref;
17694         CHECK(a->arr_len == 32);
17695         memcpy(a_ref.data, a->elems, 32); FREE(a);
17696         void* b_ptr = untag_ptr(b);
17697         CHECK_ACCESS(b_ptr);
17698         LDKCOption_BlockHashZ b_conv = *(LDKCOption_BlockHashZ*)(b_ptr);
17699         b_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(b));
17700         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
17701         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_new(a_ref, b_conv);
17702         return tag_ptr(ret_conv, true);
17703 }
17704
17705 void  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_free"))) TS_C2Tuple_TxidCOption_BlockHashZZ_free(uint64_t _res) {
17706         if (!ptr_is_owned(_res)) return;
17707         void* _res_ptr = untag_ptr(_res);
17708         CHECK_ACCESS(_res_ptr);
17709         LDKC2Tuple_TxidCOption_BlockHashZZ _res_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(_res_ptr);
17710         FREE(untag_ptr(_res));
17711         C2Tuple_TxidCOption_BlockHashZZ_free(_res_conv);
17712 }
17713
17714 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCOption_BlockHashZZZ_free"))) TS_CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(uint64_tArray _res) {
17715         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ _res_constr;
17716         _res_constr.datalen = _res->arr_len;
17717         if (_res_constr.datalen > 0)
17718                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ Elements");
17719         else
17720                 _res_constr.data = NULL;
17721         uint64_t* _res_vals = _res->elems;
17722         for (size_t i = 0; i < _res_constr.datalen; i++) {
17723                 uint64_t _res_conv_34 = _res_vals[i];
17724                 void* _res_conv_34_ptr = untag_ptr(_res_conv_34);
17725                 CHECK_ACCESS(_res_conv_34_ptr);
17726                 LDKC2Tuple_TxidCOption_BlockHashZZ _res_conv_34_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(_res_conv_34_ptr);
17727                 FREE(untag_ptr(_res_conv_34));
17728                 _res_constr.data[i] = _res_conv_34_conv;
17729         }
17730         FREE(_res);
17731         CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(_res_constr);
17732 }
17733
17734 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
17735         LDKCVec_MonitorEventZ _res_constr;
17736         _res_constr.datalen = _res->arr_len;
17737         if (_res_constr.datalen > 0)
17738                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17739         else
17740                 _res_constr.data = NULL;
17741         uint64_t* _res_vals = _res->elems;
17742         for (size_t o = 0; o < _res_constr.datalen; o++) {
17743                 uint64_t _res_conv_14 = _res_vals[o];
17744                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
17745                 CHECK_ACCESS(_res_conv_14_ptr);
17746                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
17747                 FREE(untag_ptr(_res_conv_14));
17748                 _res_constr.data[o] = _res_conv_14_conv;
17749         }
17750         FREE(_res);
17751         CVec_MonitorEventZ_free(_res_constr);
17752 }
17753
17754 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
17755         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17756         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
17757         return tag_ptr(ret_conv, true);
17758 }
17759 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
17760         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
17761         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
17762         return ret_conv;
17763 }
17764
17765 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
17766         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
17767         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17768         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
17769         return tag_ptr(ret_conv, true);
17770 }
17771
17772 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
17773         LDKOutPoint a_conv;
17774         a_conv.inner = untag_ptr(a);
17775         a_conv.is_owned = ptr_is_owned(a);
17776         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17777         a_conv = OutPoint_clone(&a_conv);
17778         LDKCVec_MonitorEventZ b_constr;
17779         b_constr.datalen = b->arr_len;
17780         if (b_constr.datalen > 0)
17781                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17782         else
17783                 b_constr.data = NULL;
17784         uint64_t* b_vals = b->elems;
17785         for (size_t o = 0; o < b_constr.datalen; o++) {
17786                 uint64_t b_conv_14 = b_vals[o];
17787                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
17788                 CHECK_ACCESS(b_conv_14_ptr);
17789                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
17790                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
17791                 b_constr.data[o] = b_conv_14_conv;
17792         }
17793         FREE(b);
17794         LDKPublicKey c_ref;
17795         CHECK(c->arr_len == 33);
17796         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
17797         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17798         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
17799         return tag_ptr(ret_conv, true);
17800 }
17801
17802 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
17803         if (!ptr_is_owned(_res)) return;
17804         void* _res_ptr = untag_ptr(_res);
17805         CHECK_ACCESS(_res_ptr);
17806         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
17807         FREE(untag_ptr(_res));
17808         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
17809 }
17810
17811 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
17812         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
17813         _res_constr.datalen = _res->arr_len;
17814         if (_res_constr.datalen > 0)
17815                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
17816         else
17817                 _res_constr.data = NULL;
17818         uint64_t* _res_vals = _res->elems;
17819         for (size_t x = 0; x < _res_constr.datalen; x++) {
17820                 uint64_t _res_conv_49 = _res_vals[x];
17821                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
17822                 CHECK_ACCESS(_res_conv_49_ptr);
17823                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
17824                 FREE(untag_ptr(_res_conv_49));
17825                 _res_constr.data[x] = _res_conv_49_conv;
17826         }
17827         FREE(_res);
17828         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
17829 }
17830
17831 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
17832         LDKFixedPenaltyScorer o_conv;
17833         o_conv.inner = untag_ptr(o);
17834         o_conv.is_owned = ptr_is_owned(o);
17835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17836         o_conv = FixedPenaltyScorer_clone(&o_conv);
17837         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17838         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
17839         return tag_ptr(ret_conv, true);
17840 }
17841
17842 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
17843         void* e_ptr = untag_ptr(e);
17844         CHECK_ACCESS(e_ptr);
17845         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17846         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17847         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17848         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
17849         return tag_ptr(ret_conv, true);
17850 }
17851
17852 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
17853         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
17854         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
17855         return ret_conv;
17856 }
17857
17858 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
17859         if (!ptr_is_owned(_res)) return;
17860         void* _res_ptr = untag_ptr(_res);
17861         CHECK_ACCESS(_res_ptr);
17862         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
17863         FREE(untag_ptr(_res));
17864         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
17865 }
17866
17867 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
17868         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17869         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
17870         return tag_ptr(ret_conv, true);
17871 }
17872 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
17873         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
17874         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
17875         return ret_conv;
17876 }
17877
17878 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
17879         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
17880         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17881         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
17882         return tag_ptr(ret_conv, true);
17883 }
17884
17885 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
17886         LDKCVec_NodeIdZ _res_constr;
17887         _res_constr.datalen = _res->arr_len;
17888         if (_res_constr.datalen > 0)
17889                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
17890         else
17891                 _res_constr.data = NULL;
17892         uint64_t* _res_vals = _res->elems;
17893         for (size_t i = 0; i < _res_constr.datalen; i++) {
17894                 uint64_t _res_conv_8 = _res_vals[i];
17895                 LDKNodeId _res_conv_8_conv;
17896                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
17897                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
17898                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
17899                 _res_constr.data[i] = _res_conv_8_conv;
17900         }
17901         FREE(_res);
17902         CVec_NodeIdZ_free(_res_constr);
17903 }
17904
17905 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
17906         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17907         *ret_conv = C2Tuple_u64u64Z_clone(arg);
17908         return tag_ptr(ret_conv, true);
17909 }
17910 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
17911         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
17912         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
17913         return ret_conv;
17914 }
17915
17916 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
17917         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
17918         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17919         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
17920         return tag_ptr(ret_conv, true);
17921 }
17922
17923 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
17924         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17925         *ret_conv = C2Tuple_u64u64Z_new(a, b);
17926         return tag_ptr(ret_conv, true);
17927 }
17928
17929 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
17930         if (!ptr_is_owned(_res)) return;
17931         void* _res_ptr = untag_ptr(_res);
17932         CHECK_ACCESS(_res_ptr);
17933         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
17934         FREE(untag_ptr(_res));
17935         C2Tuple_u64u64Z_free(_res_conv);
17936 }
17937
17938 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
17939         void* o_ptr = untag_ptr(o);
17940         CHECK_ACCESS(o_ptr);
17941         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
17942         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
17943         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17944         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
17945         uint64_t ret_ref = tag_ptr(ret_copy, true);
17946         return ret_ref;
17947 }
17948
17949 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
17950         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17951         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
17952         uint64_t ret_ref = tag_ptr(ret_copy, true);
17953         return ret_ref;
17954 }
17955
17956 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
17957         if (!ptr_is_owned(_res)) return;
17958         void* _res_ptr = untag_ptr(_res);
17959         CHECK_ACCESS(_res_ptr);
17960         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
17961         FREE(untag_ptr(_res));
17962         COption_C2Tuple_u64u64ZZ_free(_res_conv);
17963 }
17964
17965 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
17966         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17967         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
17968         uint64_t ret_ref = tag_ptr(ret_copy, true);
17969         return ret_ref;
17970 }
17971 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
17972         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
17973         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
17974         return ret_conv;
17975 }
17976
17977 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
17978         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
17979         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17980         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
17981         uint64_t ret_ref = tag_ptr(ret_copy, true);
17982         return ret_ref;
17983 }
17984
17985 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
17986         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
17987         *ret_conv = C2Tuple_Z_clone(arg);
17988         return tag_ptr(ret_conv, true);
17989 }
17990 int64_t  __attribute__((export_name("TS_C2Tuple_Z_clone_ptr"))) TS_C2Tuple_Z_clone_ptr(uint64_t arg) {
17991         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
17992         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
17993         return ret_conv;
17994 }
17995
17996 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_clone"))) TS_C2Tuple_Z_clone(uint64_t orig) {
17997         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
17998         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
17999         *ret_conv = C2Tuple_Z_clone(orig_conv);
18000         return tag_ptr(ret_conv, true);
18001 }
18002
18003 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
18004         LDKEightU16s a_ref;
18005         CHECK(a->arr_len == 8);
18006         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
18007         LDKEightU16s b_ref;
18008         CHECK(b->arr_len == 8);
18009         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
18010         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
18011         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
18012         return tag_ptr(ret_conv, true);
18013 }
18014
18015 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
18016         if (!ptr_is_owned(_res)) return;
18017         void* _res_ptr = untag_ptr(_res);
18018         CHECK_ACCESS(_res_ptr);
18019         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
18020         FREE(untag_ptr(_res));
18021         C2Tuple_Z_free(_res_conv);
18022 }
18023
18024 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
18025         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18026         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
18027         return tag_ptr(ret_conv, true);
18028 }
18029 int64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone_ptr"))) TS_C2Tuple__u168_u168Z_clone_ptr(uint64_t arg) {
18030         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
18031         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
18032         return ret_conv;
18033 }
18034
18035 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone"))) TS_C2Tuple__u168_u168Z_clone(uint64_t orig) {
18036         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
18037         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18038         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
18039         return tag_ptr(ret_conv, true);
18040 }
18041
18042 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_new"))) TS_C2Tuple__u168_u168Z_new(int16_tArray a, int16_tArray b) {
18043         LDKEightU16s a_ref;
18044         CHECK(a->arr_len == 8);
18045         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
18046         LDKEightU16s b_ref;
18047         CHECK(b->arr_len == 8);
18048         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
18049         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18050         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
18051         return tag_ptr(ret_conv, true);
18052 }
18053
18054 void  __attribute__((export_name("TS_C2Tuple__u168_u168Z_free"))) TS_C2Tuple__u168_u168Z_free(uint64_t _res) {
18055         if (!ptr_is_owned(_res)) return;
18056         void* _res_ptr = untag_ptr(_res);
18057         CHECK_ACCESS(_res_ptr);
18058         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
18059         FREE(untag_ptr(_res));
18060         C2Tuple__u168_u168Z_free(_res_conv);
18061 }
18062
18063 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_some"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_some(uint64_t o) {
18064         void* o_ptr = untag_ptr(o);
18065         CHECK_ACCESS(o_ptr);
18066         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
18067         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
18068         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18069         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
18070         uint64_t ret_ref = tag_ptr(ret_copy, true);
18071         return ret_ref;
18072 }
18073
18074 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_none"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_none() {
18075         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18076         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
18077         uint64_t ret_ref = tag_ptr(ret_copy, true);
18078         return ret_ref;
18079 }
18080
18081 void  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_free"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_free(uint64_t _res) {
18082         if (!ptr_is_owned(_res)) return;
18083         void* _res_ptr = untag_ptr(_res);
18084         CHECK_ACCESS(_res_ptr);
18085         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
18086         FREE(untag_ptr(_res));
18087         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
18088 }
18089
18090 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
18091         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18092         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
18093         uint64_t ret_ref = tag_ptr(ret_copy, true);
18094         return ret_ref;
18095 }
18096 int64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(uint64_t arg) {
18097         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
18098         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
18099         return ret_conv;
18100 }
18101
18102 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone(uint64_t orig) {
18103         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
18104         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18105         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
18106         uint64_t ret_ref = tag_ptr(ret_copy, true);
18107         return ret_ref;
18108 }
18109
18110 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
18111         LDKProbabilisticScorer o_conv;
18112         o_conv.inner = untag_ptr(o);
18113         o_conv.is_owned = ptr_is_owned(o);
18114         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18115         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
18116         
18117         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18118         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
18119         return tag_ptr(ret_conv, true);
18120 }
18121
18122 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
18123         void* e_ptr = untag_ptr(e);
18124         CHECK_ACCESS(e_ptr);
18125         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18126         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18127         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18128         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
18129         return tag_ptr(ret_conv, true);
18130 }
18131
18132 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
18133         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
18134         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
18135         return ret_conv;
18136 }
18137
18138 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
18139         if (!ptr_is_owned(_res)) return;
18140         void* _res_ptr = untag_ptr(_res);
18141         CHECK_ACCESS(_res_ptr);
18142         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
18143         FREE(untag_ptr(_res));
18144         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
18145 }
18146
18147 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
18148         LDKInitFeatures o_conv;
18149         o_conv.inner = untag_ptr(o);
18150         o_conv.is_owned = ptr_is_owned(o);
18151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18152         o_conv = InitFeatures_clone(&o_conv);
18153         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18154         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
18155         return tag_ptr(ret_conv, true);
18156 }
18157
18158 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
18159         void* e_ptr = untag_ptr(e);
18160         CHECK_ACCESS(e_ptr);
18161         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18162         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18163         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18164         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
18165         return tag_ptr(ret_conv, true);
18166 }
18167
18168 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18169         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
18170         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
18171         return ret_conv;
18172 }
18173
18174 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
18175         if (!ptr_is_owned(_res)) return;
18176         void* _res_ptr = untag_ptr(_res);
18177         CHECK_ACCESS(_res_ptr);
18178         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
18179         FREE(untag_ptr(_res));
18180         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
18181 }
18182
18183 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18184         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18185         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
18186         return tag_ptr(ret_conv, true);
18187 }
18188 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18189         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
18190         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18191         return ret_conv;
18192 }
18193
18194 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
18195         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
18196         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18197         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
18198         return tag_ptr(ret_conv, true);
18199 }
18200
18201 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
18202         LDKChannelFeatures o_conv;
18203         o_conv.inner = untag_ptr(o);
18204         o_conv.is_owned = ptr_is_owned(o);
18205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18206         o_conv = ChannelFeatures_clone(&o_conv);
18207         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18208         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
18209         return tag_ptr(ret_conv, true);
18210 }
18211
18212 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
18213         void* e_ptr = untag_ptr(e);
18214         CHECK_ACCESS(e_ptr);
18215         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18216         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18217         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18218         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
18219         return tag_ptr(ret_conv, true);
18220 }
18221
18222 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18223         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
18224         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
18225         return ret_conv;
18226 }
18227
18228 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
18229         if (!ptr_is_owned(_res)) return;
18230         void* _res_ptr = untag_ptr(_res);
18231         CHECK_ACCESS(_res_ptr);
18232         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
18233         FREE(untag_ptr(_res));
18234         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
18235 }
18236
18237 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18238         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18239         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
18240         return tag_ptr(ret_conv, true);
18241 }
18242 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18243         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
18244         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18245         return ret_conv;
18246 }
18247
18248 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
18249         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
18250         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18251         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
18252         return tag_ptr(ret_conv, true);
18253 }
18254
18255 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
18256         LDKNodeFeatures o_conv;
18257         o_conv.inner = untag_ptr(o);
18258         o_conv.is_owned = ptr_is_owned(o);
18259         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18260         o_conv = NodeFeatures_clone(&o_conv);
18261         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18262         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
18263         return tag_ptr(ret_conv, true);
18264 }
18265
18266 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
18267         void* e_ptr = untag_ptr(e);
18268         CHECK_ACCESS(e_ptr);
18269         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18270         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18271         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18272         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
18273         return tag_ptr(ret_conv, true);
18274 }
18275
18276 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18277         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
18278         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
18279         return ret_conv;
18280 }
18281
18282 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
18283         if (!ptr_is_owned(_res)) return;
18284         void* _res_ptr = untag_ptr(_res);
18285         CHECK_ACCESS(_res_ptr);
18286         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
18287         FREE(untag_ptr(_res));
18288         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
18289 }
18290
18291 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18292         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18293         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
18294         return tag_ptr(ret_conv, true);
18295 }
18296 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18297         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
18298         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18299         return ret_conv;
18300 }
18301
18302 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18303         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
18304         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18305         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
18306         return tag_ptr(ret_conv, true);
18307 }
18308
18309 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18310         LDKBolt11InvoiceFeatures o_conv;
18311         o_conv.inner = untag_ptr(o);
18312         o_conv.is_owned = ptr_is_owned(o);
18313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18314         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
18315         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18316         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18317         return tag_ptr(ret_conv, true);
18318 }
18319
18320 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18321         void* e_ptr = untag_ptr(e);
18322         CHECK_ACCESS(e_ptr);
18323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18325         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18326         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
18327         return tag_ptr(ret_conv, true);
18328 }
18329
18330 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18331         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18332         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18333         return ret_conv;
18334 }
18335
18336 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18337         if (!ptr_is_owned(_res)) return;
18338         void* _res_ptr = untag_ptr(_res);
18339         CHECK_ACCESS(_res_ptr);
18340         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18341         FREE(untag_ptr(_res));
18342         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18343 }
18344
18345 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18346         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18347         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
18348         return tag_ptr(ret_conv, true);
18349 }
18350 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18351         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18352         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18353         return ret_conv;
18354 }
18355
18356 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18357         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18358         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18359         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18360         return tag_ptr(ret_conv, true);
18361 }
18362
18363 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18364         LDKBolt12InvoiceFeatures o_conv;
18365         o_conv.inner = untag_ptr(o);
18366         o_conv.is_owned = ptr_is_owned(o);
18367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18368         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
18369         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18370         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18371         return tag_ptr(ret_conv, true);
18372 }
18373
18374 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18375         void* e_ptr = untag_ptr(e);
18376         CHECK_ACCESS(e_ptr);
18377         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18378         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18379         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18380         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
18381         return tag_ptr(ret_conv, true);
18382 }
18383
18384 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18385         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18386         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18387         return ret_conv;
18388 }
18389
18390 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18391         if (!ptr_is_owned(_res)) return;
18392         void* _res_ptr = untag_ptr(_res);
18393         CHECK_ACCESS(_res_ptr);
18394         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18395         FREE(untag_ptr(_res));
18396         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18397 }
18398
18399 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18400         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18401         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
18402         return tag_ptr(ret_conv, true);
18403 }
18404 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18405         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18406         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18407         return ret_conv;
18408 }
18409
18410 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18411         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18412         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18413         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18414         return tag_ptr(ret_conv, true);
18415 }
18416
18417 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
18418         LDKBlindedHopFeatures o_conv;
18419         o_conv.inner = untag_ptr(o);
18420         o_conv.is_owned = ptr_is_owned(o);
18421         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18422         o_conv = BlindedHopFeatures_clone(&o_conv);
18423         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18424         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
18425         return tag_ptr(ret_conv, true);
18426 }
18427
18428 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
18429         void* e_ptr = untag_ptr(e);
18430         CHECK_ACCESS(e_ptr);
18431         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18432         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18433         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18434         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
18435         return tag_ptr(ret_conv, true);
18436 }
18437
18438 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18439         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
18440         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
18441         return ret_conv;
18442 }
18443
18444 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
18445         if (!ptr_is_owned(_res)) return;
18446         void* _res_ptr = untag_ptr(_res);
18447         CHECK_ACCESS(_res_ptr);
18448         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
18449         FREE(untag_ptr(_res));
18450         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
18451 }
18452
18453 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18454         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18455         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
18456         return tag_ptr(ret_conv, true);
18457 }
18458 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18459         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
18460         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18461         return ret_conv;
18462 }
18463
18464 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
18465         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
18466         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18467         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
18468         return tag_ptr(ret_conv, true);
18469 }
18470
18471 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
18472         LDKChannelTypeFeatures o_conv;
18473         o_conv.inner = untag_ptr(o);
18474         o_conv.is_owned = ptr_is_owned(o);
18475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18476         o_conv = ChannelTypeFeatures_clone(&o_conv);
18477         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18478         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
18479         return tag_ptr(ret_conv, true);
18480 }
18481
18482 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
18483         void* e_ptr = untag_ptr(e);
18484         CHECK_ACCESS(e_ptr);
18485         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18486         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18487         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18488         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
18489         return tag_ptr(ret_conv, true);
18490 }
18491
18492 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18493         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
18494         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
18495         return ret_conv;
18496 }
18497
18498 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
18499         if (!ptr_is_owned(_res)) return;
18500         void* _res_ptr = untag_ptr(_res);
18501         CHECK_ACCESS(_res_ptr);
18502         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
18503         FREE(untag_ptr(_res));
18504         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
18505 }
18506
18507 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18508         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18509         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
18510         return tag_ptr(ret_conv, true);
18511 }
18512 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18513         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
18514         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18515         return ret_conv;
18516 }
18517
18518 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18519         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
18520         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18521         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
18522         return tag_ptr(ret_conv, true);
18523 }
18524
18525 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
18526         void* o_ptr = untag_ptr(o);
18527         CHECK_ACCESS(o_ptr);
18528         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
18529         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
18530         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
18531         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
18532         return tag_ptr(ret_conv, true);
18533 }
18534
18535 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
18536         void* e_ptr = untag_ptr(e);
18537         CHECK_ACCESS(e_ptr);
18538         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18539         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18540         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
18541         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
18542         return tag_ptr(ret_conv, true);
18543 }
18544
18545 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
18546         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
18547         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
18548         return ret_conv;
18549 }
18550
18551 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
18552         if (!ptr_is_owned(_res)) return;
18553         void* _res_ptr = untag_ptr(_res);
18554         CHECK_ACCESS(_res_ptr);
18555         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
18556         FREE(untag_ptr(_res));
18557         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
18558 }
18559
18560 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
18561         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
18562         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
18563         return tag_ptr(ret_conv, true);
18564 }
18565 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
18566         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
18567         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
18568         return ret_conv;
18569 }
18570
18571 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
18572         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
18573         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
18574         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
18575         return tag_ptr(ret_conv, true);
18576 }
18577
18578 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
18579         void* o_ptr = untag_ptr(o);
18580         CHECK_ACCESS(o_ptr);
18581         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
18582         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
18583         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18584         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
18585         uint64_t ret_ref = tag_ptr(ret_copy, true);
18586         return ret_ref;
18587 }
18588
18589 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
18590         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18591         *ret_copy = COption_NetworkUpdateZ_none();
18592         uint64_t ret_ref = tag_ptr(ret_copy, true);
18593         return ret_ref;
18594 }
18595
18596 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
18597         if (!ptr_is_owned(_res)) return;
18598         void* _res_ptr = untag_ptr(_res);
18599         CHECK_ACCESS(_res_ptr);
18600         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
18601         FREE(untag_ptr(_res));
18602         COption_NetworkUpdateZ_free(_res_conv);
18603 }
18604
18605 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
18606         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18607         *ret_copy = COption_NetworkUpdateZ_clone(arg);
18608         uint64_t ret_ref = tag_ptr(ret_copy, true);
18609         return ret_ref;
18610 }
18611 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
18612         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
18613         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
18614         return ret_conv;
18615 }
18616
18617 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
18618         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
18619         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18620         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
18621         uint64_t ret_ref = tag_ptr(ret_copy, true);
18622         return ret_ref;
18623 }
18624
18625 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
18626         void* o_ptr = untag_ptr(o);
18627         CHECK_ACCESS(o_ptr);
18628         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
18629         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
18630         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
18631         *ret_copy = COption_PathFailureZ_some(o_conv);
18632         uint64_t ret_ref = tag_ptr(ret_copy, true);
18633         return ret_ref;
18634 }
18635
18636 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
18637         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
18638         *ret_copy = COption_PathFailureZ_none();
18639         uint64_t ret_ref = tag_ptr(ret_copy, true);
18640         return ret_ref;
18641 }
18642
18643 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
18644         if (!ptr_is_owned(_res)) return;
18645         void* _res_ptr = untag_ptr(_res);
18646         CHECK_ACCESS(_res_ptr);
18647         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
18648         FREE(untag_ptr(_res));
18649         COption_PathFailureZ_free(_res_conv);
18650 }
18651
18652 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
18653         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
18654         *ret_copy = COption_PathFailureZ_clone(arg);
18655         uint64_t ret_ref = tag_ptr(ret_copy, true);
18656         return ret_ref;
18657 }
18658 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
18659         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
18660         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
18661         return ret_conv;
18662 }
18663
18664 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
18665         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
18666         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
18667         *ret_copy = COption_PathFailureZ_clone(orig_conv);
18668         uint64_t ret_ref = tag_ptr(ret_copy, true);
18669         return ret_ref;
18670 }
18671
18672 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
18673         void* o_ptr = untag_ptr(o);
18674         CHECK_ACCESS(o_ptr);
18675         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
18676         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
18677         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
18678         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
18679         return tag_ptr(ret_conv, true);
18680 }
18681
18682 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
18683         void* e_ptr = untag_ptr(e);
18684         CHECK_ACCESS(e_ptr);
18685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18687         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
18688         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
18689         return tag_ptr(ret_conv, true);
18690 }
18691
18692 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
18693         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
18694         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
18695         return ret_conv;
18696 }
18697
18698 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
18699         if (!ptr_is_owned(_res)) return;
18700         void* _res_ptr = untag_ptr(_res);
18701         CHECK_ACCESS(_res_ptr);
18702         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
18703         FREE(untag_ptr(_res));
18704         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
18705 }
18706
18707 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
18708         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
18709         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
18710         return tag_ptr(ret_conv, true);
18711 }
18712 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
18713         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
18714         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
18715         return ret_conv;
18716 }
18717
18718 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
18719         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
18720         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
18721         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
18722         return tag_ptr(ret_conv, true);
18723 }
18724
18725 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
18726         void* o_ptr = untag_ptr(o);
18727         CHECK_ACCESS(o_ptr);
18728         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
18729         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
18730         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
18731         *ret_copy = COption_ClosureReasonZ_some(o_conv);
18732         uint64_t ret_ref = tag_ptr(ret_copy, true);
18733         return ret_ref;
18734 }
18735
18736 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
18737         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
18738         *ret_copy = COption_ClosureReasonZ_none();
18739         uint64_t ret_ref = tag_ptr(ret_copy, true);
18740         return ret_ref;
18741 }
18742
18743 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
18744         if (!ptr_is_owned(_res)) return;
18745         void* _res_ptr = untag_ptr(_res);
18746         CHECK_ACCESS(_res_ptr);
18747         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
18748         FREE(untag_ptr(_res));
18749         COption_ClosureReasonZ_free(_res_conv);
18750 }
18751
18752 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
18753         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
18754         *ret_copy = COption_ClosureReasonZ_clone(arg);
18755         uint64_t ret_ref = tag_ptr(ret_copy, true);
18756         return ret_ref;
18757 }
18758 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
18759         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
18760         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
18761         return ret_conv;
18762 }
18763
18764 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
18765         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
18766         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
18767         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
18768         uint64_t ret_ref = tag_ptr(ret_copy, true);
18769         return ret_ref;
18770 }
18771
18772 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
18773         void* o_ptr = untag_ptr(o);
18774         CHECK_ACCESS(o_ptr);
18775         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
18776         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
18777         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
18778         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
18779         return tag_ptr(ret_conv, true);
18780 }
18781
18782 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
18783         void* e_ptr = untag_ptr(e);
18784         CHECK_ACCESS(e_ptr);
18785         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18786         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18787         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
18788         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
18789         return tag_ptr(ret_conv, true);
18790 }
18791
18792 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
18793         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
18794         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
18795         return ret_conv;
18796 }
18797
18798 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
18799         if (!ptr_is_owned(_res)) return;
18800         void* _res_ptr = untag_ptr(_res);
18801         CHECK_ACCESS(_res_ptr);
18802         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
18803         FREE(untag_ptr(_res));
18804         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
18805 }
18806
18807 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
18808         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
18809         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
18810         return tag_ptr(ret_conv, true);
18811 }
18812 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
18813         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
18814         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
18815         return ret_conv;
18816 }
18817
18818 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
18819         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
18820         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
18821         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
18822         return tag_ptr(ret_conv, true);
18823 }
18824
18825 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
18826         void* o_ptr = untag_ptr(o);
18827         CHECK_ACCESS(o_ptr);
18828         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
18829         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
18830         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18831         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
18832         uint64_t ret_ref = tag_ptr(ret_copy, true);
18833         return ret_ref;
18834 }
18835
18836 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
18837         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18838         *ret_copy = COption_HTLCDestinationZ_none();
18839         uint64_t ret_ref = tag_ptr(ret_copy, true);
18840         return ret_ref;
18841 }
18842
18843 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
18844         if (!ptr_is_owned(_res)) return;
18845         void* _res_ptr = untag_ptr(_res);
18846         CHECK_ACCESS(_res_ptr);
18847         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
18848         FREE(untag_ptr(_res));
18849         COption_HTLCDestinationZ_free(_res_conv);
18850 }
18851
18852 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
18853         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18854         *ret_copy = COption_HTLCDestinationZ_clone(arg);
18855         uint64_t ret_ref = tag_ptr(ret_copy, true);
18856         return ret_ref;
18857 }
18858 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
18859         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
18860         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
18861         return ret_conv;
18862 }
18863
18864 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
18865         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
18866         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18867         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
18868         uint64_t ret_ref = tag_ptr(ret_copy, true);
18869         return ret_ref;
18870 }
18871
18872 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
18873         void* o_ptr = untag_ptr(o);
18874         CHECK_ACCESS(o_ptr);
18875         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
18876         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
18877         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18878         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
18879         return tag_ptr(ret_conv, true);
18880 }
18881
18882 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
18883         void* e_ptr = untag_ptr(e);
18884         CHECK_ACCESS(e_ptr);
18885         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18886         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18887         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18888         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
18889         return tag_ptr(ret_conv, true);
18890 }
18891
18892 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
18893         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
18894         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
18895         return ret_conv;
18896 }
18897
18898 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
18899         if (!ptr_is_owned(_res)) return;
18900         void* _res_ptr = untag_ptr(_res);
18901         CHECK_ACCESS(_res_ptr);
18902         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
18903         FREE(untag_ptr(_res));
18904         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
18905 }
18906
18907 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
18908         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18909         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
18910         return tag_ptr(ret_conv, true);
18911 }
18912 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
18913         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
18914         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
18915         return ret_conv;
18916 }
18917
18918 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
18919         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
18920         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18921         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
18922         return tag_ptr(ret_conv, true);
18923 }
18924
18925 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
18926         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
18927         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
18928         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
18929         return tag_ptr(ret_conv, true);
18930 }
18931
18932 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
18933         void* e_ptr = untag_ptr(e);
18934         CHECK_ACCESS(e_ptr);
18935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18937         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
18938         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
18939         return tag_ptr(ret_conv, true);
18940 }
18941
18942 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
18943         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
18944         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
18945         return ret_conv;
18946 }
18947
18948 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
18949         if (!ptr_is_owned(_res)) return;
18950         void* _res_ptr = untag_ptr(_res);
18951         CHECK_ACCESS(_res_ptr);
18952         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
18953         FREE(untag_ptr(_res));
18954         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
18955 }
18956
18957 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
18958         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
18959         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
18960         return tag_ptr(ret_conv, true);
18961 }
18962 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
18963         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
18964         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
18965         return ret_conv;
18966 }
18967
18968 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
18969         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
18970         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
18971         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
18972         return tag_ptr(ret_conv, true);
18973 }
18974
18975 uint64_t  __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) {
18976         LDKU128 o_ref;
18977         CHECK(o->arr_len == 16);
18978         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
18979         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
18980         *ret_copy = COption_u128Z_some(o_ref);
18981         uint64_t ret_ref = tag_ptr(ret_copy, true);
18982         return ret_ref;
18983 }
18984
18985 uint64_t  __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() {
18986         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
18987         *ret_copy = COption_u128Z_none();
18988         uint64_t ret_ref = tag_ptr(ret_copy, true);
18989         return ret_ref;
18990 }
18991
18992 void  __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) {
18993         if (!ptr_is_owned(_res)) return;
18994         void* _res_ptr = untag_ptr(_res);
18995         CHECK_ACCESS(_res_ptr);
18996         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
18997         FREE(untag_ptr(_res));
18998         COption_u128Z_free(_res_conv);
18999 }
19000
19001 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
19002         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
19003         *ret_copy = COption_u128Z_clone(arg);
19004         uint64_t ret_ref = tag_ptr(ret_copy, true);
19005         return ret_ref;
19006 }
19007 int64_t  __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) {
19008         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
19009         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
19010         return ret_conv;
19011 }
19012
19013 uint64_t  __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) {
19014         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
19015         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
19016         *ret_copy = COption_u128Z_clone(orig_conv);
19017         uint64_t ret_ref = tag_ptr(ret_copy, true);
19018         return ret_ref;
19019 }
19020
19021 uint64_t  __attribute__((export_name("TS_COption_PaymentIdZ_some"))) TS_COption_PaymentIdZ_some(int8_tArray o) {
19022         LDKThirtyTwoBytes o_ref;
19023         CHECK(o->arr_len == 32);
19024         memcpy(o_ref.data, o->elems, 32); FREE(o);
19025         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
19026         *ret_copy = COption_PaymentIdZ_some(o_ref);
19027         uint64_t ret_ref = tag_ptr(ret_copy, true);
19028         return ret_ref;
19029 }
19030
19031 uint64_t  __attribute__((export_name("TS_COption_PaymentIdZ_none"))) TS_COption_PaymentIdZ_none() {
19032         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
19033         *ret_copy = COption_PaymentIdZ_none();
19034         uint64_t ret_ref = tag_ptr(ret_copy, true);
19035         return ret_ref;
19036 }
19037
19038 void  __attribute__((export_name("TS_COption_PaymentIdZ_free"))) TS_COption_PaymentIdZ_free(uint64_t _res) {
19039         if (!ptr_is_owned(_res)) return;
19040         void* _res_ptr = untag_ptr(_res);
19041         CHECK_ACCESS(_res_ptr);
19042         LDKCOption_PaymentIdZ _res_conv = *(LDKCOption_PaymentIdZ*)(_res_ptr);
19043         FREE(untag_ptr(_res));
19044         COption_PaymentIdZ_free(_res_conv);
19045 }
19046
19047 static inline uint64_t COption_PaymentIdZ_clone_ptr(LDKCOption_PaymentIdZ *NONNULL_PTR arg) {
19048         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
19049         *ret_copy = COption_PaymentIdZ_clone(arg);
19050         uint64_t ret_ref = tag_ptr(ret_copy, true);
19051         return ret_ref;
19052 }
19053 int64_t  __attribute__((export_name("TS_COption_PaymentIdZ_clone_ptr"))) TS_COption_PaymentIdZ_clone_ptr(uint64_t arg) {
19054         LDKCOption_PaymentIdZ* arg_conv = (LDKCOption_PaymentIdZ*)untag_ptr(arg);
19055         int64_t ret_conv = COption_PaymentIdZ_clone_ptr(arg_conv);
19056         return ret_conv;
19057 }
19058
19059 uint64_t  __attribute__((export_name("TS_COption_PaymentIdZ_clone"))) TS_COption_PaymentIdZ_clone(uint64_t orig) {
19060         LDKCOption_PaymentIdZ* orig_conv = (LDKCOption_PaymentIdZ*)untag_ptr(orig);
19061         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
19062         *ret_copy = COption_PaymentIdZ_clone(orig_conv);
19063         uint64_t ret_ref = tag_ptr(ret_copy, true);
19064         return ret_ref;
19065 }
19066
19067 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
19068         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
19069         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
19070         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
19071         uint64_t ret_ref = tag_ptr(ret_copy, true);
19072         return ret_ref;
19073 }
19074
19075 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
19076         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
19077         *ret_copy = COption_PaymentFailureReasonZ_none();
19078         uint64_t ret_ref = tag_ptr(ret_copy, true);
19079         return ret_ref;
19080 }
19081
19082 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
19083         if (!ptr_is_owned(_res)) return;
19084         void* _res_ptr = untag_ptr(_res);
19085         CHECK_ACCESS(_res_ptr);
19086         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
19087         FREE(untag_ptr(_res));
19088         COption_PaymentFailureReasonZ_free(_res_conv);
19089 }
19090
19091 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
19092         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
19093         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
19094         uint64_t ret_ref = tag_ptr(ret_copy, true);
19095         return ret_ref;
19096 }
19097 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
19098         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
19099         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
19100         return ret_conv;
19101 }
19102
19103 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
19104         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
19105         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
19106         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
19107         uint64_t ret_ref = tag_ptr(ret_copy, true);
19108         return ret_ref;
19109 }
19110
19111 uint64_t  __attribute__((export_name("TS_COption_PaymentHashZ_some"))) TS_COption_PaymentHashZ_some(int8_tArray o) {
19112         LDKThirtyTwoBytes o_ref;
19113         CHECK(o->arr_len == 32);
19114         memcpy(o_ref.data, o->elems, 32); FREE(o);
19115         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
19116         *ret_copy = COption_PaymentHashZ_some(o_ref);
19117         uint64_t ret_ref = tag_ptr(ret_copy, true);
19118         return ret_ref;
19119 }
19120
19121 uint64_t  __attribute__((export_name("TS_COption_PaymentHashZ_none"))) TS_COption_PaymentHashZ_none() {
19122         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
19123         *ret_copy = COption_PaymentHashZ_none();
19124         uint64_t ret_ref = tag_ptr(ret_copy, true);
19125         return ret_ref;
19126 }
19127
19128 void  __attribute__((export_name("TS_COption_PaymentHashZ_free"))) TS_COption_PaymentHashZ_free(uint64_t _res) {
19129         if (!ptr_is_owned(_res)) return;
19130         void* _res_ptr = untag_ptr(_res);
19131         CHECK_ACCESS(_res_ptr);
19132         LDKCOption_PaymentHashZ _res_conv = *(LDKCOption_PaymentHashZ*)(_res_ptr);
19133         FREE(untag_ptr(_res));
19134         COption_PaymentHashZ_free(_res_conv);
19135 }
19136
19137 static inline uint64_t COption_PaymentHashZ_clone_ptr(LDKCOption_PaymentHashZ *NONNULL_PTR arg) {
19138         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
19139         *ret_copy = COption_PaymentHashZ_clone(arg);
19140         uint64_t ret_ref = tag_ptr(ret_copy, true);
19141         return ret_ref;
19142 }
19143 int64_t  __attribute__((export_name("TS_COption_PaymentHashZ_clone_ptr"))) TS_COption_PaymentHashZ_clone_ptr(uint64_t arg) {
19144         LDKCOption_PaymentHashZ* arg_conv = (LDKCOption_PaymentHashZ*)untag_ptr(arg);
19145         int64_t ret_conv = COption_PaymentHashZ_clone_ptr(arg_conv);
19146         return ret_conv;
19147 }
19148
19149 uint64_t  __attribute__((export_name("TS_COption_PaymentHashZ_clone"))) TS_COption_PaymentHashZ_clone(uint64_t orig) {
19150         LDKCOption_PaymentHashZ* orig_conv = (LDKCOption_PaymentHashZ*)untag_ptr(orig);
19151         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
19152         *ret_copy = COption_PaymentHashZ_clone(orig_conv);
19153         uint64_t ret_ref = tag_ptr(ret_copy, true);
19154         return ret_ref;
19155 }
19156
19157 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
19158         void* o_ptr = untag_ptr(o);
19159         CHECK_ACCESS(o_ptr);
19160         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
19161         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
19162         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
19163         *ret_copy = COption_EventZ_some(o_conv);
19164         uint64_t ret_ref = tag_ptr(ret_copy, true);
19165         return ret_ref;
19166 }
19167
19168 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
19169         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
19170         *ret_copy = COption_EventZ_none();
19171         uint64_t ret_ref = tag_ptr(ret_copy, true);
19172         return ret_ref;
19173 }
19174
19175 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
19176         if (!ptr_is_owned(_res)) return;
19177         void* _res_ptr = untag_ptr(_res);
19178         CHECK_ACCESS(_res_ptr);
19179         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
19180         FREE(untag_ptr(_res));
19181         COption_EventZ_free(_res_conv);
19182 }
19183
19184 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
19185         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
19186         *ret_copy = COption_EventZ_clone(arg);
19187         uint64_t ret_ref = tag_ptr(ret_copy, true);
19188         return ret_ref;
19189 }
19190 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
19191         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
19192         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
19193         return ret_conv;
19194 }
19195
19196 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
19197         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
19198         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
19199         *ret_copy = COption_EventZ_clone(orig_conv);
19200         uint64_t ret_ref = tag_ptr(ret_copy, true);
19201         return ret_ref;
19202 }
19203
19204 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
19205         void* o_ptr = untag_ptr(o);
19206         CHECK_ACCESS(o_ptr);
19207         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
19208         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
19209         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19210         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
19211         return tag_ptr(ret_conv, true);
19212 }
19213
19214 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
19215         void* e_ptr = untag_ptr(e);
19216         CHECK_ACCESS(e_ptr);
19217         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19218         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19219         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19220         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
19221         return tag_ptr(ret_conv, true);
19222 }
19223
19224 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
19225         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
19226         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
19227         return ret_conv;
19228 }
19229
19230 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
19231         if (!ptr_is_owned(_res)) return;
19232         void* _res_ptr = untag_ptr(_res);
19233         CHECK_ACCESS(_res_ptr);
19234         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
19235         FREE(untag_ptr(_res));
19236         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
19237 }
19238
19239 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
19240         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19241         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
19242         return tag_ptr(ret_conv, true);
19243 }
19244 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
19245         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
19246         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
19247         return ret_conv;
19248 }
19249
19250 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
19251         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
19252         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19253         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
19254         return tag_ptr(ret_conv, true);
19255 }
19256
19257 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
19258         LDKCVec_MessageSendEventZ _res_constr;
19259         _res_constr.datalen = _res->arr_len;
19260         if (_res_constr.datalen > 0)
19261                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
19262         else
19263                 _res_constr.data = NULL;
19264         uint64_t* _res_vals = _res->elems;
19265         for (size_t s = 0; s < _res_constr.datalen; s++) {
19266                 uint64_t _res_conv_18 = _res_vals[s];
19267                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
19268                 CHECK_ACCESS(_res_conv_18_ptr);
19269                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
19270                 FREE(untag_ptr(_res_conv_18));
19271                 _res_constr.data[s] = _res_conv_18_conv;
19272         }
19273         FREE(_res);
19274         CVec_MessageSendEventZ_free(_res_constr);
19275 }
19276
19277 void  __attribute__((export_name("TS_CVec_ChainHashZ_free"))) TS_CVec_ChainHashZ_free(ptrArray _res) {
19278         LDKCVec_ChainHashZ _res_constr;
19279         _res_constr.datalen = _res->arr_len;
19280         if (_res_constr.datalen > 0)
19281                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
19282         else
19283                 _res_constr.data = NULL;
19284         int8_tArray* _res_vals = (void*) _res->elems;
19285         for (size_t m = 0; m < _res_constr.datalen; m++) {
19286                 int8_tArray _res_conv_12 = _res_vals[m];
19287                 LDKThirtyTwoBytes _res_conv_12_ref;
19288                 CHECK(_res_conv_12->arr_len == 32);
19289                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
19290                 _res_constr.data[m] = _res_conv_12_ref;
19291         }
19292         FREE(_res);
19293         CVec_ChainHashZ_free(_res_constr);
19294 }
19295
19296 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
19297         LDKOffer o_conv;
19298         o_conv.inner = untag_ptr(o);
19299         o_conv.is_owned = ptr_is_owned(o);
19300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19301         o_conv = Offer_clone(&o_conv);
19302         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19303         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
19304         return tag_ptr(ret_conv, true);
19305 }
19306
19307 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
19308         LDKBolt12ParseError e_conv;
19309         e_conv.inner = untag_ptr(e);
19310         e_conv.is_owned = ptr_is_owned(e);
19311         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19312         e_conv = Bolt12ParseError_clone(&e_conv);
19313         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19314         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
19315         return tag_ptr(ret_conv, true);
19316 }
19317
19318 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
19319         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
19320         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
19321         return ret_conv;
19322 }
19323
19324 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
19325         if (!ptr_is_owned(_res)) return;
19326         void* _res_ptr = untag_ptr(_res);
19327         CHECK_ACCESS(_res_ptr);
19328         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
19329         FREE(untag_ptr(_res));
19330         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
19331 }
19332
19333 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
19334         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19335         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
19336         return tag_ptr(ret_conv, true);
19337 }
19338 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
19339         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
19340         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
19341         return ret_conv;
19342 }
19343
19344 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
19345         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
19346         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19347         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
19348         return tag_ptr(ret_conv, true);
19349 }
19350
19351 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
19352         LDKPublicKey o_ref;
19353         CHECK(o->arr_len == 33);
19354         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
19355         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19356         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
19357         return tag_ptr(ret_conv, true);
19358 }
19359
19360 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
19361         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
19362         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19363         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
19364         return tag_ptr(ret_conv, true);
19365 }
19366
19367 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
19368         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
19369         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
19370         return ret_conv;
19371 }
19372
19373 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
19374         if (!ptr_is_owned(_res)) return;
19375         void* _res_ptr = untag_ptr(_res);
19376         CHECK_ACCESS(_res_ptr);
19377         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
19378         FREE(untag_ptr(_res));
19379         CResult_PublicKeyErrorZ_free(_res_conv);
19380 }
19381
19382 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
19383         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19384         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
19385         return tag_ptr(ret_conv, true);
19386 }
19387 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
19388         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
19389         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
19390         return ret_conv;
19391 }
19392
19393 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
19394         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
19395         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19396         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
19397         return tag_ptr(ret_conv, true);
19398 }
19399
19400 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
19401         LDKNodeId o_conv;
19402         o_conv.inner = untag_ptr(o);
19403         o_conv.is_owned = ptr_is_owned(o);
19404         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19405         o_conv = NodeId_clone(&o_conv);
19406         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19407         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
19408         return tag_ptr(ret_conv, true);
19409 }
19410
19411 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
19412         void* e_ptr = untag_ptr(e);
19413         CHECK_ACCESS(e_ptr);
19414         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19415         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19416         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19417         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
19418         return tag_ptr(ret_conv, true);
19419 }
19420
19421 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
19422         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
19423         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
19424         return ret_conv;
19425 }
19426
19427 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
19428         if (!ptr_is_owned(_res)) return;
19429         void* _res_ptr = untag_ptr(_res);
19430         CHECK_ACCESS(_res_ptr);
19431         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
19432         FREE(untag_ptr(_res));
19433         CResult_NodeIdDecodeErrorZ_free(_res_conv);
19434 }
19435
19436 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
19437         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19438         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
19439         return tag_ptr(ret_conv, true);
19440 }
19441 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
19442         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
19443         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
19444         return ret_conv;
19445 }
19446
19447 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
19448         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
19449         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19450         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
19451         return tag_ptr(ret_conv, true);
19452 }
19453
19454 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
19455         void* o_ptr = untag_ptr(o);
19456         CHECK_ACCESS(o_ptr);
19457         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
19458         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
19459         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19460         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
19461         return tag_ptr(ret_conv, true);
19462 }
19463
19464 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
19465         void* e_ptr = untag_ptr(e);
19466         CHECK_ACCESS(e_ptr);
19467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19469         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19470         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
19471         return tag_ptr(ret_conv, true);
19472 }
19473
19474 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
19475         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
19476         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
19477         return ret_conv;
19478 }
19479
19480 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
19481         if (!ptr_is_owned(_res)) return;
19482         void* _res_ptr = untag_ptr(_res);
19483         CHECK_ACCESS(_res_ptr);
19484         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
19485         FREE(untag_ptr(_res));
19486         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
19487 }
19488
19489 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
19490         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19491         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
19492         return tag_ptr(ret_conv, true);
19493 }
19494 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
19495         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
19496         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
19497         return ret_conv;
19498 }
19499
19500 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
19501         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
19502         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19503         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
19504         return tag_ptr(ret_conv, true);
19505 }
19506
19507 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
19508         void* o_ptr = untag_ptr(o);
19509         CHECK_ACCESS(o_ptr);
19510         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
19511         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
19512                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19513                 LDKUtxoLookup_JCalls_cloned(&o_conv);
19514         }
19515         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19516         *ret_copy = COption_UtxoLookupZ_some(o_conv);
19517         uint64_t ret_ref = tag_ptr(ret_copy, true);
19518         return ret_ref;
19519 }
19520
19521 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
19522         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19523         *ret_copy = COption_UtxoLookupZ_none();
19524         uint64_t ret_ref = tag_ptr(ret_copy, true);
19525         return ret_ref;
19526 }
19527
19528 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
19529         if (!ptr_is_owned(_res)) return;
19530         void* _res_ptr = untag_ptr(_res);
19531         CHECK_ACCESS(_res_ptr);
19532         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
19533         FREE(untag_ptr(_res));
19534         COption_UtxoLookupZ_free(_res_conv);
19535 }
19536
19537 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
19538         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19539         *ret_conv = CResult_NoneLightningErrorZ_ok();
19540         return tag_ptr(ret_conv, true);
19541 }
19542
19543 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
19544         LDKLightningError e_conv;
19545         e_conv.inner = untag_ptr(e);
19546         e_conv.is_owned = ptr_is_owned(e);
19547         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19548         e_conv = LightningError_clone(&e_conv);
19549         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19550         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
19551         return tag_ptr(ret_conv, true);
19552 }
19553
19554 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
19555         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
19556         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
19557         return ret_conv;
19558 }
19559
19560 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
19561         if (!ptr_is_owned(_res)) return;
19562         void* _res_ptr = untag_ptr(_res);
19563         CHECK_ACCESS(_res_ptr);
19564         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
19565         FREE(untag_ptr(_res));
19566         CResult_NoneLightningErrorZ_free(_res_conv);
19567 }
19568
19569 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19570         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19571         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19572         return tag_ptr(ret_conv, true);
19573 }
19574 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
19575         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
19576         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19577         return ret_conv;
19578 }
19579
19580 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
19581         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
19582         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19583         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19584         return tag_ptr(ret_conv, true);
19585 }
19586
19587 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
19588         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19589         *ret_conv = CResult_boolLightningErrorZ_ok(o);
19590         return tag_ptr(ret_conv, true);
19591 }
19592
19593 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
19594         LDKLightningError e_conv;
19595         e_conv.inner = untag_ptr(e);
19596         e_conv.is_owned = ptr_is_owned(e);
19597         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19598         e_conv = LightningError_clone(&e_conv);
19599         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19600         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19601         return tag_ptr(ret_conv, true);
19602 }
19603
19604 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
19605         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
19606         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
19607         return ret_conv;
19608 }
19609
19610 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
19611         if (!ptr_is_owned(_res)) return;
19612         void* _res_ptr = untag_ptr(_res);
19613         CHECK_ACCESS(_res_ptr);
19614         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19615         FREE(untag_ptr(_res));
19616         CResult_boolLightningErrorZ_free(_res_conv);
19617 }
19618
19619 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19620         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19621         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19622         return tag_ptr(ret_conv, true);
19623 }
19624 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
19625         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
19626         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19627         return ret_conv;
19628 }
19629
19630 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
19631         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
19632         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19633         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19634         return tag_ptr(ret_conv, true);
19635 }
19636
19637 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19638         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19639         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19640         return tag_ptr(ret_conv, true);
19641 }
19642 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
19643         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
19644         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19645         return ret_conv;
19646 }
19647
19648 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
19649         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
19650         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19651         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19652         return tag_ptr(ret_conv, true);
19653 }
19654
19655 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
19656         LDKChannelAnnouncement a_conv;
19657         a_conv.inner = untag_ptr(a);
19658         a_conv.is_owned = ptr_is_owned(a);
19659         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19660         a_conv = ChannelAnnouncement_clone(&a_conv);
19661         LDKChannelUpdate b_conv;
19662         b_conv.inner = untag_ptr(b);
19663         b_conv.is_owned = ptr_is_owned(b);
19664         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19665         b_conv = ChannelUpdate_clone(&b_conv);
19666         LDKChannelUpdate c_conv;
19667         c_conv.inner = untag_ptr(c);
19668         c_conv.is_owned = ptr_is_owned(c);
19669         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19670         c_conv = ChannelUpdate_clone(&c_conv);
19671         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19672         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19673         return tag_ptr(ret_conv, true);
19674 }
19675
19676 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
19677         if (!ptr_is_owned(_res)) return;
19678         void* _res_ptr = untag_ptr(_res);
19679         CHECK_ACCESS(_res_ptr);
19680         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19681         FREE(untag_ptr(_res));
19682         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19683 }
19684
19685 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
19686         void* o_ptr = untag_ptr(o);
19687         CHECK_ACCESS(o_ptr);
19688         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
19689         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
19690         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19691         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
19692         uint64_t ret_ref = tag_ptr(ret_copy, true);
19693         return ret_ref;
19694 }
19695
19696 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
19697         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19698         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
19699         uint64_t ret_ref = tag_ptr(ret_copy, true);
19700         return ret_ref;
19701 }
19702
19703 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
19704         if (!ptr_is_owned(_res)) return;
19705         void* _res_ptr = untag_ptr(_res);
19706         CHECK_ACCESS(_res_ptr);
19707         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
19708         FREE(untag_ptr(_res));
19709         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
19710 }
19711
19712 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
19713         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19714         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
19715         uint64_t ret_ref = tag_ptr(ret_copy, true);
19716         return ret_ref;
19717 }
19718 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
19719         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
19720         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
19721         return ret_conv;
19722 }
19723
19724 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
19725         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
19726         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19727         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
19728         uint64_t ret_ref = tag_ptr(ret_copy, true);
19729         return ret_ref;
19730 }
19731
19732 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
19733         LDKChannelUpdateInfo o_conv;
19734         o_conv.inner = untag_ptr(o);
19735         o_conv.is_owned = ptr_is_owned(o);
19736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19737         o_conv = ChannelUpdateInfo_clone(&o_conv);
19738         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19739         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
19740         return tag_ptr(ret_conv, true);
19741 }
19742
19743 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
19744         void* e_ptr = untag_ptr(e);
19745         CHECK_ACCESS(e_ptr);
19746         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19747         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19748         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19749         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
19750         return tag_ptr(ret_conv, true);
19751 }
19752
19753 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
19754         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
19755         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
19756         return ret_conv;
19757 }
19758
19759 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
19760         if (!ptr_is_owned(_res)) return;
19761         void* _res_ptr = untag_ptr(_res);
19762         CHECK_ACCESS(_res_ptr);
19763         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
19764         FREE(untag_ptr(_res));
19765         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
19766 }
19767
19768 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
19769         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19770         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
19771         return tag_ptr(ret_conv, true);
19772 }
19773 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19774         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
19775         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
19776         return ret_conv;
19777 }
19778
19779 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
19780         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
19781         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19782         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
19783         return tag_ptr(ret_conv, true);
19784 }
19785
19786 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
19787         LDKChannelInfo o_conv;
19788         o_conv.inner = untag_ptr(o);
19789         o_conv.is_owned = ptr_is_owned(o);
19790         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19791         o_conv = ChannelInfo_clone(&o_conv);
19792         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19793         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
19794         return tag_ptr(ret_conv, true);
19795 }
19796
19797 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
19798         void* e_ptr = untag_ptr(e);
19799         CHECK_ACCESS(e_ptr);
19800         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19801         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19802         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19803         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
19804         return tag_ptr(ret_conv, true);
19805 }
19806
19807 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
19808         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
19809         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
19810         return ret_conv;
19811 }
19812
19813 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
19814         if (!ptr_is_owned(_res)) return;
19815         void* _res_ptr = untag_ptr(_res);
19816         CHECK_ACCESS(_res_ptr);
19817         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
19818         FREE(untag_ptr(_res));
19819         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
19820 }
19821
19822 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19823         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19824         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
19825         return tag_ptr(ret_conv, true);
19826 }
19827 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19828         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
19829         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19830         return ret_conv;
19831 }
19832
19833 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
19834         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
19835         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19836         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
19837         return tag_ptr(ret_conv, true);
19838 }
19839
19840 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
19841         LDKRoutingFees o_conv;
19842         o_conv.inner = untag_ptr(o);
19843         o_conv.is_owned = ptr_is_owned(o);
19844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19845         o_conv = RoutingFees_clone(&o_conv);
19846         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19847         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
19848         return tag_ptr(ret_conv, true);
19849 }
19850
19851 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
19852         void* e_ptr = untag_ptr(e);
19853         CHECK_ACCESS(e_ptr);
19854         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19855         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19856         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19857         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
19858         return tag_ptr(ret_conv, true);
19859 }
19860
19861 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
19862         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
19863         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
19864         return ret_conv;
19865 }
19866
19867 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
19868         if (!ptr_is_owned(_res)) return;
19869         void* _res_ptr = untag_ptr(_res);
19870         CHECK_ACCESS(_res_ptr);
19871         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
19872         FREE(untag_ptr(_res));
19873         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
19874 }
19875
19876 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
19877         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19878         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
19879         return tag_ptr(ret_conv, true);
19880 }
19881 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
19882         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
19883         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
19884         return ret_conv;
19885 }
19886
19887 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
19888         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
19889         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19890         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
19891         return tag_ptr(ret_conv, true);
19892 }
19893
19894 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
19895         LDKCVec_NetAddressZ _res_constr;
19896         _res_constr.datalen = _res->arr_len;
19897         if (_res_constr.datalen > 0)
19898                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19899         else
19900                 _res_constr.data = NULL;
19901         uint64_t* _res_vals = _res->elems;
19902         for (size_t m = 0; m < _res_constr.datalen; m++) {
19903                 uint64_t _res_conv_12 = _res_vals[m];
19904                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
19905                 CHECK_ACCESS(_res_conv_12_ptr);
19906                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
19907                 FREE(untag_ptr(_res_conv_12));
19908                 _res_constr.data[m] = _res_conv_12_conv;
19909         }
19910         FREE(_res);
19911         CVec_NetAddressZ_free(_res_constr);
19912 }
19913
19914 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
19915         LDKNodeAnnouncementInfo o_conv;
19916         o_conv.inner = untag_ptr(o);
19917         o_conv.is_owned = ptr_is_owned(o);
19918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19919         o_conv = NodeAnnouncementInfo_clone(&o_conv);
19920         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19921         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
19922         return tag_ptr(ret_conv, true);
19923 }
19924
19925 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
19926         void* e_ptr = untag_ptr(e);
19927         CHECK_ACCESS(e_ptr);
19928         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19929         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19930         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19931         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
19932         return tag_ptr(ret_conv, true);
19933 }
19934
19935 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
19936         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
19937         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
19938         return ret_conv;
19939 }
19940
19941 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
19942         if (!ptr_is_owned(_res)) return;
19943         void* _res_ptr = untag_ptr(_res);
19944         CHECK_ACCESS(_res_ptr);
19945         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
19946         FREE(untag_ptr(_res));
19947         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
19948 }
19949
19950 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
19951         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19952         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
19953         return tag_ptr(ret_conv, true);
19954 }
19955 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19956         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
19957         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
19958         return ret_conv;
19959 }
19960
19961 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
19962         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
19963         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19964         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
19965         return tag_ptr(ret_conv, true);
19966 }
19967
19968 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
19969         LDKNodeAlias o_conv;
19970         o_conv.inner = untag_ptr(o);
19971         o_conv.is_owned = ptr_is_owned(o);
19972         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19973         o_conv = NodeAlias_clone(&o_conv);
19974         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19975         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
19976         return tag_ptr(ret_conv, true);
19977 }
19978
19979 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
19980         void* e_ptr = untag_ptr(e);
19981         CHECK_ACCESS(e_ptr);
19982         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19983         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19984         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19985         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
19986         return tag_ptr(ret_conv, true);
19987 }
19988
19989 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
19990         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
19991         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
19992         return ret_conv;
19993 }
19994
19995 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
19996         if (!ptr_is_owned(_res)) return;
19997         void* _res_ptr = untag_ptr(_res);
19998         CHECK_ACCESS(_res_ptr);
19999         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
20000         FREE(untag_ptr(_res));
20001         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
20002 }
20003
20004 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
20005         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
20006         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
20007         return tag_ptr(ret_conv, true);
20008 }
20009 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
20010         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
20011         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
20012         return ret_conv;
20013 }
20014
20015 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
20016         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
20017         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
20018         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
20019         return tag_ptr(ret_conv, true);
20020 }
20021
20022 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
20023         LDKNodeInfo o_conv;
20024         o_conv.inner = untag_ptr(o);
20025         o_conv.is_owned = ptr_is_owned(o);
20026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20027         o_conv = NodeInfo_clone(&o_conv);
20028         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20029         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
20030         return tag_ptr(ret_conv, true);
20031 }
20032
20033 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
20034         void* e_ptr = untag_ptr(e);
20035         CHECK_ACCESS(e_ptr);
20036         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20037         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20038         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20039         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
20040         return tag_ptr(ret_conv, true);
20041 }
20042
20043 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
20044         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
20045         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
20046         return ret_conv;
20047 }
20048
20049 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
20050         if (!ptr_is_owned(_res)) return;
20051         void* _res_ptr = untag_ptr(_res);
20052         CHECK_ACCESS(_res_ptr);
20053         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
20054         FREE(untag_ptr(_res));
20055         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
20056 }
20057
20058 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
20059         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20060         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
20061         return tag_ptr(ret_conv, true);
20062 }
20063 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
20064         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
20065         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
20066         return ret_conv;
20067 }
20068
20069 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
20070         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
20071         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20072         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
20073         return tag_ptr(ret_conv, true);
20074 }
20075
20076 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
20077         LDKNetworkGraph o_conv;
20078         o_conv.inner = untag_ptr(o);
20079         o_conv.is_owned = ptr_is_owned(o);
20080         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20081         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
20082         
20083         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20084         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
20085         return tag_ptr(ret_conv, true);
20086 }
20087
20088 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
20089         void* e_ptr = untag_ptr(e);
20090         CHECK_ACCESS(e_ptr);
20091         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20092         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20093         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20094         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
20095         return tag_ptr(ret_conv, true);
20096 }
20097
20098 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
20099         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
20100         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
20101         return ret_conv;
20102 }
20103
20104 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
20105         if (!ptr_is_owned(_res)) return;
20106         void* _res_ptr = untag_ptr(_res);
20107         CHECK_ACCESS(_res_ptr);
20108         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
20109         FREE(untag_ptr(_res));
20110         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
20111 }
20112
20113 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
20114         LDKCVec_NetAddressZ o_constr;
20115         o_constr.datalen = o->arr_len;
20116         if (o_constr.datalen > 0)
20117                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20118         else
20119                 o_constr.data = NULL;
20120         uint64_t* o_vals = o->elems;
20121         for (size_t m = 0; m < o_constr.datalen; m++) {
20122                 uint64_t o_conv_12 = o_vals[m];
20123                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
20124                 CHECK_ACCESS(o_conv_12_ptr);
20125                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
20126                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
20127                 o_constr.data[m] = o_conv_12_conv;
20128         }
20129         FREE(o);
20130         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20131         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
20132         uint64_t ret_ref = tag_ptr(ret_copy, true);
20133         return ret_ref;
20134 }
20135
20136 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
20137         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20138         *ret_copy = COption_CVec_NetAddressZZ_none();
20139         uint64_t ret_ref = tag_ptr(ret_copy, true);
20140         return ret_ref;
20141 }
20142
20143 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
20144         if (!ptr_is_owned(_res)) return;
20145         void* _res_ptr = untag_ptr(_res);
20146         CHECK_ACCESS(_res_ptr);
20147         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
20148         FREE(untag_ptr(_res));
20149         COption_CVec_NetAddressZZ_free(_res_conv);
20150 }
20151
20152 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
20153         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20154         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
20155         uint64_t ret_ref = tag_ptr(ret_copy, true);
20156         return ret_ref;
20157 }
20158 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
20159         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
20160         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
20161         return ret_conv;
20162 }
20163
20164 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
20165         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
20166         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20167         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
20168         uint64_t ret_ref = tag_ptr(ret_copy, true);
20169         return ret_ref;
20170 }
20171
20172 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
20173         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
20174         _res_constr.datalen = _res->arr_len;
20175         if (_res_constr.datalen > 0)
20176                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
20177         else
20178                 _res_constr.data = NULL;
20179         uint64_t* _res_vals = _res->elems;
20180         for (size_t y = 0; y < _res_constr.datalen; y++) {
20181                 uint64_t _res_conv_24 = _res_vals[y];
20182                 LDKHTLCOutputInCommitment _res_conv_24_conv;
20183                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
20184                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
20185                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
20186                 _res_constr.data[y] = _res_conv_24_conv;
20187         }
20188         FREE(_res);
20189         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
20190 }
20191
20192 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
20193         LDKCVec_HTLCDescriptorZ _res_constr;
20194         _res_constr.datalen = _res->arr_len;
20195         if (_res_constr.datalen > 0)
20196                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
20197         else
20198                 _res_constr.data = NULL;
20199         uint64_t* _res_vals = _res->elems;
20200         for (size_t q = 0; q < _res_constr.datalen; q++) {
20201                 uint64_t _res_conv_16 = _res_vals[q];
20202                 LDKHTLCDescriptor _res_conv_16_conv;
20203                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20204                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20205                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20206                 _res_constr.data[q] = _res_conv_16_conv;
20207         }
20208         FREE(_res);
20209         CVec_HTLCDescriptorZ_free(_res_constr);
20210 }
20211
20212 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
20213         LDKCVec_UtxoZ _res_constr;
20214         _res_constr.datalen = _res->arr_len;
20215         if (_res_constr.datalen > 0)
20216                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
20217         else
20218                 _res_constr.data = NULL;
20219         uint64_t* _res_vals = _res->elems;
20220         for (size_t g = 0; g < _res_constr.datalen; g++) {
20221                 uint64_t _res_conv_6 = _res_vals[g];
20222                 LDKUtxo _res_conv_6_conv;
20223                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
20224                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
20225                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
20226                 _res_constr.data[g] = _res_conv_6_conv;
20227         }
20228         FREE(_res);
20229         CVec_UtxoZ_free(_res_constr);
20230 }
20231
20232 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
20233         void* o_ptr = untag_ptr(o);
20234         CHECK_ACCESS(o_ptr);
20235         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
20236         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
20237         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20238         *ret_copy = COption_TxOutZ_some(o_conv);
20239         uint64_t ret_ref = tag_ptr(ret_copy, true);
20240         return ret_ref;
20241 }
20242
20243 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
20244         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20245         *ret_copy = COption_TxOutZ_none();
20246         uint64_t ret_ref = tag_ptr(ret_copy, true);
20247         return ret_ref;
20248 }
20249
20250 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
20251         if (!ptr_is_owned(_res)) return;
20252         void* _res_ptr = untag_ptr(_res);
20253         CHECK_ACCESS(_res_ptr);
20254         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
20255         FREE(untag_ptr(_res));
20256         COption_TxOutZ_free(_res_conv);
20257 }
20258
20259 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
20260         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20261         *ret_copy = COption_TxOutZ_clone(arg);
20262         uint64_t ret_ref = tag_ptr(ret_copy, true);
20263         return ret_ref;
20264 }
20265 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
20266         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
20267         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
20268         return ret_conv;
20269 }
20270
20271 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
20272         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
20273         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20274         *ret_copy = COption_TxOutZ_clone(orig_conv);
20275         uint64_t ret_ref = tag_ptr(ret_copy, true);
20276         return ret_ref;
20277 }
20278
20279 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
20280         LDKCVec_InputZ _res_constr;
20281         _res_constr.datalen = _res->arr_len;
20282         if (_res_constr.datalen > 0)
20283                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
20284         else
20285                 _res_constr.data = NULL;
20286         uint64_t* _res_vals = _res->elems;
20287         for (size_t h = 0; h < _res_constr.datalen; h++) {
20288                 uint64_t _res_conv_7 = _res_vals[h];
20289                 LDKInput _res_conv_7_conv;
20290                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
20291                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
20292                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
20293                 _res_constr.data[h] = _res_conv_7_conv;
20294         }
20295         FREE(_res);
20296         CVec_InputZ_free(_res_constr);
20297 }
20298
20299 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
20300         LDKCoinSelection o_conv;
20301         o_conv.inner = untag_ptr(o);
20302         o_conv.is_owned = ptr_is_owned(o);
20303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20304         o_conv = CoinSelection_clone(&o_conv);
20305         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20306         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
20307         return tag_ptr(ret_conv, true);
20308 }
20309
20310 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
20311         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20312         *ret_conv = CResult_CoinSelectionNoneZ_err();
20313         return tag_ptr(ret_conv, true);
20314 }
20315
20316 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
20317         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
20318         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
20319         return ret_conv;
20320 }
20321
20322 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
20323         if (!ptr_is_owned(_res)) return;
20324         void* _res_ptr = untag_ptr(_res);
20325         CHECK_ACCESS(_res_ptr);
20326         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
20327         FREE(untag_ptr(_res));
20328         CResult_CoinSelectionNoneZ_free(_res_conv);
20329 }
20330
20331 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
20332         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20333         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
20334         return tag_ptr(ret_conv, true);
20335 }
20336 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
20337         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
20338         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
20339         return ret_conv;
20340 }
20341
20342 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
20343         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
20344         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20345         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
20346         return tag_ptr(ret_conv, true);
20347 }
20348
20349 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
20350         LDKCVec_UtxoZ o_constr;
20351         o_constr.datalen = o->arr_len;
20352         if (o_constr.datalen > 0)
20353                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
20354         else
20355                 o_constr.data = NULL;
20356         uint64_t* o_vals = o->elems;
20357         for (size_t g = 0; g < o_constr.datalen; g++) {
20358                 uint64_t o_conv_6 = o_vals[g];
20359                 LDKUtxo o_conv_6_conv;
20360                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
20361                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
20362                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
20363                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
20364                 o_constr.data[g] = o_conv_6_conv;
20365         }
20366         FREE(o);
20367         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20368         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
20369         return tag_ptr(ret_conv, true);
20370 }
20371
20372 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
20373         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20374         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
20375         return tag_ptr(ret_conv, true);
20376 }
20377
20378 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
20379         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
20380         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
20381         return ret_conv;
20382 }
20383
20384 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_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_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
20389         FREE(untag_ptr(_res));
20390         CResult_CVec_UtxoZNoneZ_free(_res_conv);
20391 }
20392
20393 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
20394         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20395         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
20396         return tag_ptr(ret_conv, true);
20397 }
20398 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
20399         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
20400         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
20401         return ret_conv;
20402 }
20403
20404 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
20405         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
20406         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20407         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
20408         return tag_ptr(ret_conv, true);
20409 }
20410
20411 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
20412         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20413         *ret_copy = COption_u16Z_some(o);
20414         uint64_t ret_ref = tag_ptr(ret_copy, true);
20415         return ret_ref;
20416 }
20417
20418 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
20419         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20420         *ret_copy = COption_u16Z_none();
20421         uint64_t ret_ref = tag_ptr(ret_copy, true);
20422         return ret_ref;
20423 }
20424
20425 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
20426         if (!ptr_is_owned(_res)) return;
20427         void* _res_ptr = untag_ptr(_res);
20428         CHECK_ACCESS(_res_ptr);
20429         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
20430         FREE(untag_ptr(_res));
20431         COption_u16Z_free(_res_conv);
20432 }
20433
20434 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
20435         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20436         *ret_copy = COption_u16Z_clone(arg);
20437         uint64_t ret_ref = tag_ptr(ret_copy, true);
20438         return ret_ref;
20439 }
20440 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
20441         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
20442         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
20443         return ret_conv;
20444 }
20445
20446 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
20447         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
20448         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20449         *ret_copy = COption_u16Z_clone(orig_conv);
20450         uint64_t ret_ref = tag_ptr(ret_copy, true);
20451         return ret_ref;
20452 }
20453
20454 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
20455         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
20456         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20457         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
20458         uint64_t ret_ref = tag_ptr(ret_copy, true);
20459         return ret_ref;
20460 }
20461
20462 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
20463         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20464         *ret_copy = COption_ChannelShutdownStateZ_none();
20465         uint64_t ret_ref = tag_ptr(ret_copy, true);
20466         return ret_ref;
20467 }
20468
20469 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
20470         if (!ptr_is_owned(_res)) return;
20471         void* _res_ptr = untag_ptr(_res);
20472         CHECK_ACCESS(_res_ptr);
20473         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
20474         FREE(untag_ptr(_res));
20475         COption_ChannelShutdownStateZ_free(_res_conv);
20476 }
20477
20478 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
20479         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20480         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
20481         uint64_t ret_ref = tag_ptr(ret_copy, true);
20482         return ret_ref;
20483 }
20484 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
20485         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
20486         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
20487         return ret_conv;
20488 }
20489
20490 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
20491         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
20492         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20493         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
20494         uint64_t ret_ref = tag_ptr(ret_copy, true);
20495         return ret_ref;
20496 }
20497
20498 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
20499         LDKThirtyTwoBytes o_ref;
20500         CHECK(o->arr_len == 32);
20501         memcpy(o_ref.data, o->elems, 32); FREE(o);
20502         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20503         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
20504         return tag_ptr(ret_conv, true);
20505 }
20506
20507 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
20508         void* e_ptr = untag_ptr(e);
20509         CHECK_ACCESS(e_ptr);
20510         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20511         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20512         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20513         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
20514         return tag_ptr(ret_conv, true);
20515 }
20516
20517 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
20518         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
20519         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
20520         return ret_conv;
20521 }
20522
20523 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
20524         if (!ptr_is_owned(_res)) return;
20525         void* _res_ptr = untag_ptr(_res);
20526         CHECK_ACCESS(_res_ptr);
20527         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
20528         FREE(untag_ptr(_res));
20529         CResult__u832APIErrorZ_free(_res_conv);
20530 }
20531
20532 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
20533         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20534         *ret_conv = CResult__u832APIErrorZ_clone(arg);
20535         return tag_ptr(ret_conv, true);
20536 }
20537 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
20538         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
20539         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
20540         return ret_conv;
20541 }
20542
20543 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
20544         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
20545         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20546         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
20547         return tag_ptr(ret_conv, true);
20548 }
20549
20550 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
20551         LDKCVec_RecentPaymentDetailsZ _res_constr;
20552         _res_constr.datalen = _res->arr_len;
20553         if (_res_constr.datalen > 0)
20554                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
20555         else
20556                 _res_constr.data = NULL;
20557         uint64_t* _res_vals = _res->elems;
20558         for (size_t w = 0; w < _res_constr.datalen; w++) {
20559                 uint64_t _res_conv_22 = _res_vals[w];
20560                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20561                 CHECK_ACCESS(_res_conv_22_ptr);
20562                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
20563                 FREE(untag_ptr(_res_conv_22));
20564                 _res_constr.data[w] = _res_conv_22_conv;
20565         }
20566         FREE(_res);
20567         CVec_RecentPaymentDetailsZ_free(_res_constr);
20568 }
20569
20570 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
20571         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20572         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
20573         return tag_ptr(ret_conv, true);
20574 }
20575
20576 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
20577         void* e_ptr = untag_ptr(e);
20578         CHECK_ACCESS(e_ptr);
20579         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20580         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20581         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20582         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
20583         return tag_ptr(ret_conv, true);
20584 }
20585
20586 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
20587         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
20588         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
20589         return ret_conv;
20590 }
20591
20592 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
20593         if (!ptr_is_owned(_res)) return;
20594         void* _res_ptr = untag_ptr(_res);
20595         CHECK_ACCESS(_res_ptr);
20596         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
20597         FREE(untag_ptr(_res));
20598         CResult_NonePaymentSendFailureZ_free(_res_conv);
20599 }
20600
20601 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
20602         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20603         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
20604         return tag_ptr(ret_conv, true);
20605 }
20606 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
20607         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
20608         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
20609         return ret_conv;
20610 }
20611
20612 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
20613         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
20614         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20615         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
20616         return tag_ptr(ret_conv, true);
20617 }
20618
20619 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
20620         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20621         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
20622         return tag_ptr(ret_conv, true);
20623 }
20624
20625 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
20626         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20627         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20628         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
20629         return tag_ptr(ret_conv, true);
20630 }
20631
20632 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
20633         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
20634         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
20635         return ret_conv;
20636 }
20637
20638 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
20639         if (!ptr_is_owned(_res)) return;
20640         void* _res_ptr = untag_ptr(_res);
20641         CHECK_ACCESS(_res_ptr);
20642         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
20643         FREE(untag_ptr(_res));
20644         CResult_NoneRetryableSendFailureZ_free(_res_conv);
20645 }
20646
20647 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
20648         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20649         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
20650         return tag_ptr(ret_conv, true);
20651 }
20652 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20653         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
20654         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
20655         return ret_conv;
20656 }
20657
20658 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
20659         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
20660         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20661         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
20662         return tag_ptr(ret_conv, true);
20663 }
20664
20665 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
20666         LDKThirtyTwoBytes o_ref;
20667         CHECK(o->arr_len == 32);
20668         memcpy(o_ref.data, o->elems, 32); FREE(o);
20669         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20670         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
20671         return tag_ptr(ret_conv, true);
20672 }
20673
20674 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
20675         void* e_ptr = untag_ptr(e);
20676         CHECK_ACCESS(e_ptr);
20677         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20678         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20679         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20680         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
20681         return tag_ptr(ret_conv, true);
20682 }
20683
20684 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
20685         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
20686         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
20687         return ret_conv;
20688 }
20689
20690 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
20691         if (!ptr_is_owned(_res)) return;
20692         void* _res_ptr = untag_ptr(_res);
20693         CHECK_ACCESS(_res_ptr);
20694         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
20695         FREE(untag_ptr(_res));
20696         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
20697 }
20698
20699 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
20700         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20701         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
20702         return tag_ptr(ret_conv, true);
20703 }
20704 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20705         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
20706         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
20707         return ret_conv;
20708 }
20709
20710 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
20711         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
20712         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20713         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
20714         return tag_ptr(ret_conv, true);
20715 }
20716
20717 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) {
20718         LDKThirtyTwoBytes o_ref;
20719         CHECK(o->arr_len == 32);
20720         memcpy(o_ref.data, o->elems, 32); FREE(o);
20721         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
20722         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
20723         return tag_ptr(ret_conv, true);
20724 }
20725
20726 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) {
20727         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20728         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
20729         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
20730         return tag_ptr(ret_conv, true);
20731 }
20732
20733 jboolean  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) {
20734         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
20735         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
20736         return ret_conv;
20737 }
20738
20739 void  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) {
20740         if (!ptr_is_owned(_res)) return;
20741         void* _res_ptr = untag_ptr(_res);
20742         CHECK_ACCESS(_res_ptr);
20743         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
20744         FREE(untag_ptr(_res));
20745         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
20746 }
20747
20748 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
20749         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
20750         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
20751         return tag_ptr(ret_conv, true);
20752 }
20753 int64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20754         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
20755         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
20756         return ret_conv;
20757 }
20758
20759 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) {
20760         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
20761         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
20762         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
20763         return tag_ptr(ret_conv, true);
20764 }
20765
20766 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
20767         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20768         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
20769         return tag_ptr(ret_conv, true);
20770 }
20771 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
20772         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
20773         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
20774         return ret_conv;
20775 }
20776
20777 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
20778         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
20779         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20780         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
20781         return tag_ptr(ret_conv, true);
20782 }
20783
20784 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
20785         LDKThirtyTwoBytes a_ref;
20786         CHECK(a->arr_len == 32);
20787         memcpy(a_ref.data, a->elems, 32); FREE(a);
20788         LDKThirtyTwoBytes b_ref;
20789         CHECK(b->arr_len == 32);
20790         memcpy(b_ref.data, b->elems, 32); FREE(b);
20791         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20792         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
20793         return tag_ptr(ret_conv, true);
20794 }
20795
20796 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
20797         if (!ptr_is_owned(_res)) return;
20798         void* _res_ptr = untag_ptr(_res);
20799         CHECK_ACCESS(_res_ptr);
20800         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
20801         FREE(untag_ptr(_res));
20802         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
20803 }
20804
20805 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
20806         void* o_ptr = untag_ptr(o);
20807         CHECK_ACCESS(o_ptr);
20808         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
20809         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
20810         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20811         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
20812         return tag_ptr(ret_conv, true);
20813 }
20814
20815 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
20816         void* e_ptr = untag_ptr(e);
20817         CHECK_ACCESS(e_ptr);
20818         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20819         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20820         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20821         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
20822         return tag_ptr(ret_conv, true);
20823 }
20824
20825 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
20826         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
20827         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
20828         return ret_conv;
20829 }
20830
20831 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
20832         if (!ptr_is_owned(_res)) return;
20833         void* _res_ptr = untag_ptr(_res);
20834         CHECK_ACCESS(_res_ptr);
20835         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
20836         FREE(untag_ptr(_res));
20837         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
20838 }
20839
20840 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
20841         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20842         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
20843         return tag_ptr(ret_conv, true);
20844 }
20845 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20846         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
20847         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
20848         return ret_conv;
20849 }
20850
20851 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
20852         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
20853         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20854         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
20855         return tag_ptr(ret_conv, true);
20856 }
20857
20858 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
20859         LDKCVec_ThirtyTwoBytesZ _res_constr;
20860         _res_constr.datalen = _res->arr_len;
20861         if (_res_constr.datalen > 0)
20862                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
20863         else
20864                 _res_constr.data = NULL;
20865         int8_tArray* _res_vals = (void*) _res->elems;
20866         for (size_t m = 0; m < _res_constr.datalen; m++) {
20867                 int8_tArray _res_conv_12 = _res_vals[m];
20868                 LDKThirtyTwoBytes _res_conv_12_ref;
20869                 CHECK(_res_conv_12->arr_len == 32);
20870                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
20871                 _res_constr.data[m] = _res_conv_12_ref;
20872         }
20873         FREE(_res);
20874         CVec_ThirtyTwoBytesZ_free(_res_constr);
20875 }
20876
20877 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
20878         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20879         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
20880         return tag_ptr(ret_conv, true);
20881 }
20882 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
20883         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
20884         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
20885         return ret_conv;
20886 }
20887
20888 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
20889         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
20890         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20891         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
20892         return tag_ptr(ret_conv, true);
20893 }
20894
20895 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
20896         LDKThirtyTwoBytes a_ref;
20897         CHECK(a->arr_len == 32);
20898         memcpy(a_ref.data, a->elems, 32); FREE(a);
20899         LDKThirtyTwoBytes b_ref;
20900         CHECK(b->arr_len == 32);
20901         memcpy(b_ref.data, b->elems, 32); FREE(b);
20902         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20903         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
20904         return tag_ptr(ret_conv, true);
20905 }
20906
20907 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
20908         if (!ptr_is_owned(_res)) return;
20909         void* _res_ptr = untag_ptr(_res);
20910         CHECK_ACCESS(_res_ptr);
20911         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
20912         FREE(untag_ptr(_res));
20913         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
20914 }
20915
20916 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
20917         void* o_ptr = untag_ptr(o);
20918         CHECK_ACCESS(o_ptr);
20919         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
20920         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
20921         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20922         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
20923         return tag_ptr(ret_conv, true);
20924 }
20925
20926 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
20927         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20928         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
20929         return tag_ptr(ret_conv, true);
20930 }
20931
20932 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
20933         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
20934         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
20935         return ret_conv;
20936 }
20937
20938 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
20939         if (!ptr_is_owned(_res)) return;
20940         void* _res_ptr = untag_ptr(_res);
20941         CHECK_ACCESS(_res_ptr);
20942         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
20943         FREE(untag_ptr(_res));
20944         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
20945 }
20946
20947 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
20948         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20949         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
20950         return tag_ptr(ret_conv, true);
20951 }
20952 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
20953         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
20954         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
20955         return ret_conv;
20956 }
20957
20958 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
20959         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
20960         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20961         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
20962         return tag_ptr(ret_conv, true);
20963 }
20964
20965 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
20966         LDKThirtyTwoBytes o_ref;
20967         CHECK(o->arr_len == 32);
20968         memcpy(o_ref.data, o->elems, 32); FREE(o);
20969         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20970         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
20971         return tag_ptr(ret_conv, true);
20972 }
20973
20974 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
20975         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20976         *ret_conv = CResult_PaymentSecretNoneZ_err();
20977         return tag_ptr(ret_conv, true);
20978 }
20979
20980 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
20981         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
20982         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
20983         return ret_conv;
20984 }
20985
20986 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
20987         if (!ptr_is_owned(_res)) return;
20988         void* _res_ptr = untag_ptr(_res);
20989         CHECK_ACCESS(_res_ptr);
20990         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
20991         FREE(untag_ptr(_res));
20992         CResult_PaymentSecretNoneZ_free(_res_conv);
20993 }
20994
20995 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
20996         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20997         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
20998         return tag_ptr(ret_conv, true);
20999 }
21000 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
21001         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
21002         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
21003         return ret_conv;
21004 }
21005
21006 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
21007         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
21008         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
21009         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
21010         return tag_ptr(ret_conv, true);
21011 }
21012
21013 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
21014         LDKThirtyTwoBytes o_ref;
21015         CHECK(o->arr_len == 32);
21016         memcpy(o_ref.data, o->elems, 32); FREE(o);
21017         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21018         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
21019         return tag_ptr(ret_conv, true);
21020 }
21021
21022 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
21023         void* e_ptr = untag_ptr(e);
21024         CHECK_ACCESS(e_ptr);
21025         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
21026         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
21027         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21028         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
21029         return tag_ptr(ret_conv, true);
21030 }
21031
21032 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
21033         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
21034         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
21035         return ret_conv;
21036 }
21037
21038 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
21039         if (!ptr_is_owned(_res)) return;
21040         void* _res_ptr = untag_ptr(_res);
21041         CHECK_ACCESS(_res_ptr);
21042         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
21043         FREE(untag_ptr(_res));
21044         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
21045 }
21046
21047 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
21048         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21049         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
21050         return tag_ptr(ret_conv, true);
21051 }
21052 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
21053         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
21054         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
21055         return ret_conv;
21056 }
21057
21058 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
21059         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
21060         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21061         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
21062         return tag_ptr(ret_conv, true);
21063 }
21064
21065 uint64_t  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_some"))) TS_COption_CVec_ChainHashZZ_some(ptrArray o) {
21066         LDKCVec_ChainHashZ o_constr;
21067         o_constr.datalen = o->arr_len;
21068         if (o_constr.datalen > 0)
21069                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
21070         else
21071                 o_constr.data = NULL;
21072         int8_tArray* o_vals = (void*) o->elems;
21073         for (size_t m = 0; m < o_constr.datalen; m++) {
21074                 int8_tArray o_conv_12 = o_vals[m];
21075                 LDKThirtyTwoBytes o_conv_12_ref;
21076                 CHECK(o_conv_12->arr_len == 32);
21077                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
21078                 o_constr.data[m] = o_conv_12_ref;
21079         }
21080         FREE(o);
21081         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
21082         *ret_copy = COption_CVec_ChainHashZZ_some(o_constr);
21083         uint64_t ret_ref = tag_ptr(ret_copy, true);
21084         return ret_ref;
21085 }
21086
21087 uint64_t  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_none"))) TS_COption_CVec_ChainHashZZ_none() {
21088         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
21089         *ret_copy = COption_CVec_ChainHashZZ_none();
21090         uint64_t ret_ref = tag_ptr(ret_copy, true);
21091         return ret_ref;
21092 }
21093
21094 void  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_free"))) TS_COption_CVec_ChainHashZZ_free(uint64_t _res) {
21095         if (!ptr_is_owned(_res)) return;
21096         void* _res_ptr = untag_ptr(_res);
21097         CHECK_ACCESS(_res_ptr);
21098         LDKCOption_CVec_ChainHashZZ _res_conv = *(LDKCOption_CVec_ChainHashZZ*)(_res_ptr);
21099         FREE(untag_ptr(_res));
21100         COption_CVec_ChainHashZZ_free(_res_conv);
21101 }
21102
21103 static inline uint64_t COption_CVec_ChainHashZZ_clone_ptr(LDKCOption_CVec_ChainHashZZ *NONNULL_PTR arg) {
21104         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
21105         *ret_copy = COption_CVec_ChainHashZZ_clone(arg);
21106         uint64_t ret_ref = tag_ptr(ret_copy, true);
21107         return ret_ref;
21108 }
21109 int64_t  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_clone_ptr"))) TS_COption_CVec_ChainHashZZ_clone_ptr(uint64_t arg) {
21110         LDKCOption_CVec_ChainHashZZ* arg_conv = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(arg);
21111         int64_t ret_conv = COption_CVec_ChainHashZZ_clone_ptr(arg_conv);
21112         return ret_conv;
21113 }
21114
21115 uint64_t  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_clone"))) TS_COption_CVec_ChainHashZZ_clone(uint64_t orig) {
21116         LDKCOption_CVec_ChainHashZZ* orig_conv = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(orig);
21117         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
21118         *ret_copy = COption_CVec_ChainHashZZ_clone(orig_conv);
21119         uint64_t ret_ref = tag_ptr(ret_copy, true);
21120         return ret_ref;
21121 }
21122
21123 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
21124         LDKCounterpartyForwardingInfo o_conv;
21125         o_conv.inner = untag_ptr(o);
21126         o_conv.is_owned = ptr_is_owned(o);
21127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21128         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
21129         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21130         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
21131         return tag_ptr(ret_conv, true);
21132 }
21133
21134 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
21135         void* e_ptr = untag_ptr(e);
21136         CHECK_ACCESS(e_ptr);
21137         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21138         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21139         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21140         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
21141         return tag_ptr(ret_conv, true);
21142 }
21143
21144 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
21145         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
21146         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
21147         return ret_conv;
21148 }
21149
21150 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
21151         if (!ptr_is_owned(_res)) return;
21152         void* _res_ptr = untag_ptr(_res);
21153         CHECK_ACCESS(_res_ptr);
21154         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
21155         FREE(untag_ptr(_res));
21156         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
21157 }
21158
21159 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
21160         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21161         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
21162         return tag_ptr(ret_conv, true);
21163 }
21164 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
21165         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
21166         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
21167         return ret_conv;
21168 }
21169
21170 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
21171         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
21172         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21173         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
21174         return tag_ptr(ret_conv, true);
21175 }
21176
21177 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
21178         LDKChannelCounterparty o_conv;
21179         o_conv.inner = untag_ptr(o);
21180         o_conv.is_owned = ptr_is_owned(o);
21181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21182         o_conv = ChannelCounterparty_clone(&o_conv);
21183         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21184         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
21185         return tag_ptr(ret_conv, true);
21186 }
21187
21188 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
21189         void* e_ptr = untag_ptr(e);
21190         CHECK_ACCESS(e_ptr);
21191         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21192         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21193         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21194         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
21195         return tag_ptr(ret_conv, true);
21196 }
21197
21198 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
21199         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
21200         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
21201         return ret_conv;
21202 }
21203
21204 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
21205         if (!ptr_is_owned(_res)) return;
21206         void* _res_ptr = untag_ptr(_res);
21207         CHECK_ACCESS(_res_ptr);
21208         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
21209         FREE(untag_ptr(_res));
21210         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
21211 }
21212
21213 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
21214         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21215         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
21216         return tag_ptr(ret_conv, true);
21217 }
21218 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
21219         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
21220         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
21221         return ret_conv;
21222 }
21223
21224 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
21225         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
21226         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21227         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
21228         return tag_ptr(ret_conv, true);
21229 }
21230
21231 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
21232         LDKChannelDetails o_conv;
21233         o_conv.inner = untag_ptr(o);
21234         o_conv.is_owned = ptr_is_owned(o);
21235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21236         o_conv = ChannelDetails_clone(&o_conv);
21237         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21238         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
21239         return tag_ptr(ret_conv, true);
21240 }
21241
21242 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
21243         void* e_ptr = untag_ptr(e);
21244         CHECK_ACCESS(e_ptr);
21245         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21246         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21247         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21248         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
21249         return tag_ptr(ret_conv, true);
21250 }
21251
21252 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
21253         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
21254         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
21255         return ret_conv;
21256 }
21257
21258 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
21259         if (!ptr_is_owned(_res)) return;
21260         void* _res_ptr = untag_ptr(_res);
21261         CHECK_ACCESS(_res_ptr);
21262         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
21263         FREE(untag_ptr(_res));
21264         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
21265 }
21266
21267 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
21268         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21269         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
21270         return tag_ptr(ret_conv, true);
21271 }
21272 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
21273         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
21274         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
21275         return ret_conv;
21276 }
21277
21278 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
21279         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
21280         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21281         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
21282         return tag_ptr(ret_conv, true);
21283 }
21284
21285 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
21286         LDKPhantomRouteHints o_conv;
21287         o_conv.inner = untag_ptr(o);
21288         o_conv.is_owned = ptr_is_owned(o);
21289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21290         o_conv = PhantomRouteHints_clone(&o_conv);
21291         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21292         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
21293         return tag_ptr(ret_conv, true);
21294 }
21295
21296 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
21297         void* e_ptr = untag_ptr(e);
21298         CHECK_ACCESS(e_ptr);
21299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21301         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21302         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
21303         return tag_ptr(ret_conv, true);
21304 }
21305
21306 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
21307         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
21308         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
21309         return ret_conv;
21310 }
21311
21312 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
21313         if (!ptr_is_owned(_res)) return;
21314         void* _res_ptr = untag_ptr(_res);
21315         CHECK_ACCESS(_res_ptr);
21316         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
21317         FREE(untag_ptr(_res));
21318         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
21319 }
21320
21321 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
21322         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21323         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
21324         return tag_ptr(ret_conv, true);
21325 }
21326 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
21327         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
21328         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
21329         return ret_conv;
21330 }
21331
21332 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
21333         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
21334         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21335         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
21336         return tag_ptr(ret_conv, true);
21337 }
21338
21339 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
21340         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
21341         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21342         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
21343         return tag_ptr(ret_conv, true);
21344 }
21345
21346 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
21347         void* e_ptr = untag_ptr(e);
21348         CHECK_ACCESS(e_ptr);
21349         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21350         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21351         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21352         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
21353         return tag_ptr(ret_conv, true);
21354 }
21355
21356 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
21357         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
21358         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
21359         return ret_conv;
21360 }
21361
21362 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
21363         if (!ptr_is_owned(_res)) return;
21364         void* _res_ptr = untag_ptr(_res);
21365         CHECK_ACCESS(_res_ptr);
21366         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
21367         FREE(untag_ptr(_res));
21368         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
21369 }
21370
21371 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
21372         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21373         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
21374         return tag_ptr(ret_conv, true);
21375 }
21376 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
21377         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
21378         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
21379         return ret_conv;
21380 }
21381
21382 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
21383         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
21384         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21385         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
21386         return tag_ptr(ret_conv, true);
21387 }
21388
21389 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
21390         LDKCVec_ChannelMonitorZ _res_constr;
21391         _res_constr.datalen = _res->arr_len;
21392         if (_res_constr.datalen > 0)
21393                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21394         else
21395                 _res_constr.data = NULL;
21396         uint64_t* _res_vals = _res->elems;
21397         for (size_t q = 0; q < _res_constr.datalen; q++) {
21398                 uint64_t _res_conv_16 = _res_vals[q];
21399                 LDKChannelMonitor _res_conv_16_conv;
21400                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21401                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21402                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21403                 _res_constr.data[q] = _res_conv_16_conv;
21404         }
21405         FREE(_res);
21406         CVec_ChannelMonitorZ_free(_res_constr);
21407 }
21408
21409 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
21410         LDKThirtyTwoBytes a_ref;
21411         CHECK(a->arr_len == 32);
21412         memcpy(a_ref.data, a->elems, 32); FREE(a);
21413         LDKChannelManager b_conv;
21414         b_conv.inner = untag_ptr(b);
21415         b_conv.is_owned = ptr_is_owned(b);
21416         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21417         // WARNING: we need a move here but no clone is available for LDKChannelManager
21418         
21419         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
21420         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
21421         return tag_ptr(ret_conv, true);
21422 }
21423
21424 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
21425         if (!ptr_is_owned(_res)) return;
21426         void* _res_ptr = untag_ptr(_res);
21427         CHECK_ACCESS(_res_ptr);
21428         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
21429         FREE(untag_ptr(_res));
21430         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
21431 }
21432
21433 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
21434         void* o_ptr = untag_ptr(o);
21435         CHECK_ACCESS(o_ptr);
21436         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
21437         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
21438         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21439         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
21440         return tag_ptr(ret_conv, true);
21441 }
21442
21443 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
21444         void* e_ptr = untag_ptr(e);
21445         CHECK_ACCESS(e_ptr);
21446         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21447         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21448         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21449         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
21450         return tag_ptr(ret_conv, true);
21451 }
21452
21453 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
21454         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
21455         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
21456         return ret_conv;
21457 }
21458
21459 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
21460         if (!ptr_is_owned(_res)) return;
21461         void* _res_ptr = untag_ptr(_res);
21462         CHECK_ACCESS(_res_ptr);
21463         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
21464         FREE(untag_ptr(_res));
21465         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
21466 }
21467
21468 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
21469         void* o_ptr = untag_ptr(o);
21470         CHECK_ACCESS(o_ptr);
21471         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21472         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21473         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21474         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
21475         return tag_ptr(ret_conv, true);
21476 }
21477
21478 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
21479         void* e_ptr = untag_ptr(e);
21480         CHECK_ACCESS(e_ptr);
21481         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21482         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21483         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21484         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
21485         return tag_ptr(ret_conv, true);
21486 }
21487
21488 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
21489         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
21490         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
21491         return ret_conv;
21492 }
21493
21494 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
21495         if (!ptr_is_owned(_res)) return;
21496         void* _res_ptr = untag_ptr(_res);
21497         CHECK_ACCESS(_res_ptr);
21498         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
21499         FREE(untag_ptr(_res));
21500         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
21501 }
21502
21503 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
21504         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21505         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
21506         return tag_ptr(ret_conv, true);
21507 }
21508 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
21509         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
21510         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
21511         return ret_conv;
21512 }
21513
21514 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
21515         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
21516         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21517         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
21518         return tag_ptr(ret_conv, true);
21519 }
21520
21521 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
21522         LDKChannelConfig o_conv;
21523         o_conv.inner = untag_ptr(o);
21524         o_conv.is_owned = ptr_is_owned(o);
21525         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21526         o_conv = ChannelConfig_clone(&o_conv);
21527         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21528         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
21529         return tag_ptr(ret_conv, true);
21530 }
21531
21532 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
21533         void* e_ptr = untag_ptr(e);
21534         CHECK_ACCESS(e_ptr);
21535         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21536         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21537         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21538         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
21539         return tag_ptr(ret_conv, true);
21540 }
21541
21542 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
21543         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
21544         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
21545         return ret_conv;
21546 }
21547
21548 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
21549         if (!ptr_is_owned(_res)) return;
21550         void* _res_ptr = untag_ptr(_res);
21551         CHECK_ACCESS(_res_ptr);
21552         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
21553         FREE(untag_ptr(_res));
21554         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
21555 }
21556
21557 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
21558         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21559         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
21560         return tag_ptr(ret_conv, true);
21561 }
21562 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
21563         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
21564         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
21565         return ret_conv;
21566 }
21567
21568 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
21569         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
21570         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21571         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
21572         return tag_ptr(ret_conv, true);
21573 }
21574
21575 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
21576         void* o_ptr = untag_ptr(o);
21577         CHECK_ACCESS(o_ptr);
21578         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21579         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21580         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21581         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
21582         uint64_t ret_ref = tag_ptr(ret_copy, true);
21583         return ret_ref;
21584 }
21585
21586 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
21587         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21588         *ret_copy = COption_MaxDustHTLCExposureZ_none();
21589         uint64_t ret_ref = tag_ptr(ret_copy, true);
21590         return ret_ref;
21591 }
21592
21593 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
21594         if (!ptr_is_owned(_res)) return;
21595         void* _res_ptr = untag_ptr(_res);
21596         CHECK_ACCESS(_res_ptr);
21597         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
21598         FREE(untag_ptr(_res));
21599         COption_MaxDustHTLCExposureZ_free(_res_conv);
21600 }
21601
21602 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
21603         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21604         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
21605         uint64_t ret_ref = tag_ptr(ret_copy, true);
21606         return ret_ref;
21607 }
21608 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
21609         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
21610         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
21611         return ret_conv;
21612 }
21613
21614 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
21615         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
21616         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21617         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
21618         uint64_t ret_ref = tag_ptr(ret_copy, true);
21619         return ret_ref;
21620 }
21621
21622 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
21623         void* o_ptr = untag_ptr(o);
21624         CHECK_ACCESS(o_ptr);
21625         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
21626         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
21627         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21628         *ret_copy = COption_APIErrorZ_some(o_conv);
21629         uint64_t ret_ref = tag_ptr(ret_copy, true);
21630         return ret_ref;
21631 }
21632
21633 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
21634         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21635         *ret_copy = COption_APIErrorZ_none();
21636         uint64_t ret_ref = tag_ptr(ret_copy, true);
21637         return ret_ref;
21638 }
21639
21640 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
21641         if (!ptr_is_owned(_res)) return;
21642         void* _res_ptr = untag_ptr(_res);
21643         CHECK_ACCESS(_res_ptr);
21644         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
21645         FREE(untag_ptr(_res));
21646         COption_APIErrorZ_free(_res_conv);
21647 }
21648
21649 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
21650         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21651         *ret_copy = COption_APIErrorZ_clone(arg);
21652         uint64_t ret_ref = tag_ptr(ret_copy, true);
21653         return ret_ref;
21654 }
21655 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
21656         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
21657         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
21658         return ret_conv;
21659 }
21660
21661 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
21662         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
21663         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21664         *ret_copy = COption_APIErrorZ_clone(orig_conv);
21665         uint64_t ret_ref = tag_ptr(ret_copy, true);
21666         return ret_ref;
21667 }
21668
21669 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
21670         void* o_ptr = untag_ptr(o);
21671         CHECK_ACCESS(o_ptr);
21672         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
21673         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
21674         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21675         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
21676         return tag_ptr(ret_conv, true);
21677 }
21678
21679 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
21680         void* e_ptr = untag_ptr(e);
21681         CHECK_ACCESS(e_ptr);
21682         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21683         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21684         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21685         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
21686         return tag_ptr(ret_conv, true);
21687 }
21688
21689 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
21690         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
21691         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
21692         return ret_conv;
21693 }
21694
21695 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
21696         if (!ptr_is_owned(_res)) return;
21697         void* _res_ptr = untag_ptr(_res);
21698         CHECK_ACCESS(_res_ptr);
21699         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
21700         FREE(untag_ptr(_res));
21701         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
21702 }
21703
21704 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
21705         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21706         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
21707         return tag_ptr(ret_conv, true);
21708 }
21709 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
21710         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
21711         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
21712         return ret_conv;
21713 }
21714
21715 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
21716         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
21717         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21718         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
21719         return tag_ptr(ret_conv, true);
21720 }
21721
21722 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
21723         LDKBigSize o_conv;
21724         o_conv.inner = untag_ptr(o);
21725         o_conv.is_owned = ptr_is_owned(o);
21726         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21727         o_conv = BigSize_clone(&o_conv);
21728         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
21729         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
21730         return tag_ptr(ret_conv, true);
21731 }
21732
21733 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
21734         void* e_ptr = untag_ptr(e);
21735         CHECK_ACCESS(e_ptr);
21736         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21737         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21738         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
21739         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
21740         return tag_ptr(ret_conv, true);
21741 }
21742
21743 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
21744         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
21745         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
21746         return ret_conv;
21747 }
21748
21749 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
21750         if (!ptr_is_owned(_res)) return;
21751         void* _res_ptr = untag_ptr(_res);
21752         CHECK_ACCESS(_res_ptr);
21753         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
21754         FREE(untag_ptr(_res));
21755         CResult_BigSizeDecodeErrorZ_free(_res_conv);
21756 }
21757
21758 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
21759         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
21760         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
21761         return tag_ptr(ret_conv, true);
21762 }
21763 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
21764         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
21765         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
21766         return ret_conv;
21767 }
21768
21769 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
21770         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
21771         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
21772         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
21773         return tag_ptr(ret_conv, true);
21774 }
21775
21776 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
21777         LDKHostname o_conv;
21778         o_conv.inner = untag_ptr(o);
21779         o_conv.is_owned = ptr_is_owned(o);
21780         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21781         o_conv = Hostname_clone(&o_conv);
21782         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
21783         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
21784         return tag_ptr(ret_conv, true);
21785 }
21786
21787 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
21788         void* e_ptr = untag_ptr(e);
21789         CHECK_ACCESS(e_ptr);
21790         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21791         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21792         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
21793         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
21794         return tag_ptr(ret_conv, true);
21795 }
21796
21797 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
21798         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
21799         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
21800         return ret_conv;
21801 }
21802
21803 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
21804         if (!ptr_is_owned(_res)) return;
21805         void* _res_ptr = untag_ptr(_res);
21806         CHECK_ACCESS(_res_ptr);
21807         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
21808         FREE(untag_ptr(_res));
21809         CResult_HostnameDecodeErrorZ_free(_res_conv);
21810 }
21811
21812 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
21813         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
21814         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
21815         return tag_ptr(ret_conv, true);
21816 }
21817 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
21818         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
21819         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
21820         return ret_conv;
21821 }
21822
21823 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
21824         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
21825         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
21826         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
21827         return tag_ptr(ret_conv, true);
21828 }
21829
21830 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
21831         LDKTransactionU16LenLimited o_conv;
21832         o_conv.inner = untag_ptr(o);
21833         o_conv.is_owned = ptr_is_owned(o);
21834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21835         o_conv = TransactionU16LenLimited_clone(&o_conv);
21836         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
21837         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
21838         return tag_ptr(ret_conv, true);
21839 }
21840
21841 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
21842         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
21843         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
21844         return tag_ptr(ret_conv, true);
21845 }
21846
21847 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
21848         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
21849         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
21850         return ret_conv;
21851 }
21852
21853 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
21854         if (!ptr_is_owned(_res)) return;
21855         void* _res_ptr = untag_ptr(_res);
21856         CHECK_ACCESS(_res_ptr);
21857         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
21858         FREE(untag_ptr(_res));
21859         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
21860 }
21861
21862 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
21863         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
21864         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
21865         return tag_ptr(ret_conv, true);
21866 }
21867 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
21868         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
21869         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
21870         return ret_conv;
21871 }
21872
21873 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
21874         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
21875         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
21876         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
21877         return tag_ptr(ret_conv, true);
21878 }
21879
21880 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
21881         LDKTransactionU16LenLimited o_conv;
21882         o_conv.inner = untag_ptr(o);
21883         o_conv.is_owned = ptr_is_owned(o);
21884         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21885         o_conv = TransactionU16LenLimited_clone(&o_conv);
21886         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
21887         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
21888         return tag_ptr(ret_conv, true);
21889 }
21890
21891 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
21892         void* e_ptr = untag_ptr(e);
21893         CHECK_ACCESS(e_ptr);
21894         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21895         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21896         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
21897         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
21898         return tag_ptr(ret_conv, true);
21899 }
21900
21901 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
21902         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
21903         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
21904         return ret_conv;
21905 }
21906
21907 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
21908         if (!ptr_is_owned(_res)) return;
21909         void* _res_ptr = untag_ptr(_res);
21910         CHECK_ACCESS(_res_ptr);
21911         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
21912         FREE(untag_ptr(_res));
21913         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
21914 }
21915
21916 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
21917         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
21918         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
21919         return tag_ptr(ret_conv, true);
21920 }
21921 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
21922         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
21923         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
21924         return ret_conv;
21925 }
21926
21927 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
21928         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
21929         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
21930         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
21931         return tag_ptr(ret_conv, true);
21932 }
21933
21934 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
21935         LDKUntrustedString o_conv;
21936         o_conv.inner = untag_ptr(o);
21937         o_conv.is_owned = ptr_is_owned(o);
21938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21939         o_conv = UntrustedString_clone(&o_conv);
21940         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
21941         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
21942         return tag_ptr(ret_conv, true);
21943 }
21944
21945 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
21946         void* e_ptr = untag_ptr(e);
21947         CHECK_ACCESS(e_ptr);
21948         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21949         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21950         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
21951         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
21952         return tag_ptr(ret_conv, true);
21953 }
21954
21955 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
21956         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
21957         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
21958         return ret_conv;
21959 }
21960
21961 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
21962         if (!ptr_is_owned(_res)) return;
21963         void* _res_ptr = untag_ptr(_res);
21964         CHECK_ACCESS(_res_ptr);
21965         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
21966         FREE(untag_ptr(_res));
21967         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
21968 }
21969
21970 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
21971         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
21972         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
21973         return tag_ptr(ret_conv, true);
21974 }
21975 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
21976         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
21977         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
21978         return ret_conv;
21979 }
21980
21981 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
21982         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
21983         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
21984         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
21985         return tag_ptr(ret_conv, true);
21986 }
21987
21988 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
21989         LDKOutPoint o_conv;
21990         o_conv.inner = untag_ptr(o);
21991         o_conv.is_owned = ptr_is_owned(o);
21992         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21993         o_conv = OutPoint_clone(&o_conv);
21994         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
21995         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
21996         return tag_ptr(ret_conv, true);
21997 }
21998
21999 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
22000         void* e_ptr = untag_ptr(e);
22001         CHECK_ACCESS(e_ptr);
22002         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22003         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22004         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
22005         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
22006         return tag_ptr(ret_conv, true);
22007 }
22008
22009 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
22010         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
22011         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
22012         return ret_conv;
22013 }
22014
22015 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
22016         if (!ptr_is_owned(_res)) return;
22017         void* _res_ptr = untag_ptr(_res);
22018         CHECK_ACCESS(_res_ptr);
22019         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
22020         FREE(untag_ptr(_res));
22021         CResult_OutPointDecodeErrorZ_free(_res_conv);
22022 }
22023
22024 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
22025         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
22026         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
22027         return tag_ptr(ret_conv, true);
22028 }
22029 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
22030         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
22031         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
22032         return ret_conv;
22033 }
22034
22035 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
22036         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
22037         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
22038         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
22039         return tag_ptr(ret_conv, true);
22040 }
22041
22042 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
22043         void* o_ptr = untag_ptr(o);
22044         CHECK_ACCESS(o_ptr);
22045         LDKType o_conv = *(LDKType*)(o_ptr);
22046         if (o_conv.free == LDKType_JCalls_free) {
22047                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22048                 LDKType_JCalls_cloned(&o_conv);
22049         }
22050         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22051         *ret_copy = COption_TypeZ_some(o_conv);
22052         uint64_t ret_ref = tag_ptr(ret_copy, true);
22053         return ret_ref;
22054 }
22055
22056 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
22057         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22058         *ret_copy = COption_TypeZ_none();
22059         uint64_t ret_ref = tag_ptr(ret_copy, true);
22060         return ret_ref;
22061 }
22062
22063 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
22064         if (!ptr_is_owned(_res)) return;
22065         void* _res_ptr = untag_ptr(_res);
22066         CHECK_ACCESS(_res_ptr);
22067         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
22068         FREE(untag_ptr(_res));
22069         COption_TypeZ_free(_res_conv);
22070 }
22071
22072 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
22073         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22074         *ret_copy = COption_TypeZ_clone(arg);
22075         uint64_t ret_ref = tag_ptr(ret_copy, true);
22076         return ret_ref;
22077 }
22078 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
22079         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
22080         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
22081         return ret_conv;
22082 }
22083
22084 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
22085         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
22086         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22087         *ret_copy = COption_TypeZ_clone(orig_conv);
22088         uint64_t ret_ref = tag_ptr(ret_copy, true);
22089         return ret_ref;
22090 }
22091
22092 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
22093         void* o_ptr = untag_ptr(o);
22094         CHECK_ACCESS(o_ptr);
22095         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
22096         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
22097         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22098         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
22099         return tag_ptr(ret_conv, true);
22100 }
22101
22102 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
22103         void* e_ptr = untag_ptr(e);
22104         CHECK_ACCESS(e_ptr);
22105         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22106         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22107         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22108         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
22109         return tag_ptr(ret_conv, true);
22110 }
22111
22112 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
22113         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
22114         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
22115         return ret_conv;
22116 }
22117
22118 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_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_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
22123         FREE(untag_ptr(_res));
22124         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
22125 }
22126
22127 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
22128         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22129         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
22130         return tag_ptr(ret_conv, true);
22131 }
22132 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
22133         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
22134         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
22135         return ret_conv;
22136 }
22137
22138 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
22139         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
22140         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22141         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
22142         return tag_ptr(ret_conv, true);
22143 }
22144
22145 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
22146         LDKThirtyTwoBytes o_ref;
22147         CHECK(o->arr_len == 32);
22148         memcpy(o_ref.data, o->elems, 32); FREE(o);
22149         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22150         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
22151         return tag_ptr(ret_conv, true);
22152 }
22153
22154 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
22155         void* e_ptr = untag_ptr(e);
22156         CHECK_ACCESS(e_ptr);
22157         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
22158         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
22159         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22160         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
22161         return tag_ptr(ret_conv, true);
22162 }
22163
22164 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
22165         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
22166         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
22167         return ret_conv;
22168 }
22169
22170 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
22171         if (!ptr_is_owned(_res)) return;
22172         void* _res_ptr = untag_ptr(_res);
22173         CHECK_ACCESS(_res_ptr);
22174         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
22175         FREE(untag_ptr(_res));
22176         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
22177 }
22178
22179 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
22180         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22181         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
22182         return tag_ptr(ret_conv, true);
22183 }
22184 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
22185         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
22186         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
22187         return ret_conv;
22188 }
22189
22190 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
22191         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
22192         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22193         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
22194         return tag_ptr(ret_conv, true);
22195 }
22196
22197 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
22198         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22199         *ret_conv = CResult_NonePaymentErrorZ_ok();
22200         return tag_ptr(ret_conv, true);
22201 }
22202
22203 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
22204         void* e_ptr = untag_ptr(e);
22205         CHECK_ACCESS(e_ptr);
22206         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
22207         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
22208         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22209         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
22210         return tag_ptr(ret_conv, true);
22211 }
22212
22213 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
22214         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
22215         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
22216         return ret_conv;
22217 }
22218
22219 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
22220         if (!ptr_is_owned(_res)) return;
22221         void* _res_ptr = untag_ptr(_res);
22222         CHECK_ACCESS(_res_ptr);
22223         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
22224         FREE(untag_ptr(_res));
22225         CResult_NonePaymentErrorZ_free(_res_conv);
22226 }
22227
22228 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
22229         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22230         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
22231         return tag_ptr(ret_conv, true);
22232 }
22233 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
22234         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
22235         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
22236         return ret_conv;
22237 }
22238
22239 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
22240         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
22241         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22242         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
22243         return tag_ptr(ret_conv, true);
22244 }
22245
22246 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
22247         LDKStr o_conv = str_ref_to_owned_c(o);
22248         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22249         *ret_conv = CResult_StringErrorZ_ok(o_conv);
22250         return tag_ptr(ret_conv, true);
22251 }
22252
22253 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
22254         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22255         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22256         *ret_conv = CResult_StringErrorZ_err(e_conv);
22257         return tag_ptr(ret_conv, true);
22258 }
22259
22260 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
22261         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
22262         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
22263         return ret_conv;
22264 }
22265
22266 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
22267         if (!ptr_is_owned(_res)) return;
22268         void* _res_ptr = untag_ptr(_res);
22269         CHECK_ACCESS(_res_ptr);
22270         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
22271         FREE(untag_ptr(_res));
22272         CResult_StringErrorZ_free(_res_conv);
22273 }
22274
22275 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
22276         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22277         *ret_conv = CResult_StringErrorZ_clone(arg);
22278         return tag_ptr(ret_conv, true);
22279 }
22280 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
22281         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
22282         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
22283         return ret_conv;
22284 }
22285
22286 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
22287         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
22288         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22289         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
22290         return tag_ptr(ret_conv, true);
22291 }
22292
22293 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
22294         LDKChannelMonitorUpdate o_conv;
22295         o_conv.inner = untag_ptr(o);
22296         o_conv.is_owned = ptr_is_owned(o);
22297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22298         o_conv = ChannelMonitorUpdate_clone(&o_conv);
22299         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22300         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
22301         return tag_ptr(ret_conv, true);
22302 }
22303
22304 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
22305         void* e_ptr = untag_ptr(e);
22306         CHECK_ACCESS(e_ptr);
22307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22309         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22310         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
22311         return tag_ptr(ret_conv, true);
22312 }
22313
22314 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
22315         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
22316         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
22317         return ret_conv;
22318 }
22319
22320 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
22321         if (!ptr_is_owned(_res)) return;
22322         void* _res_ptr = untag_ptr(_res);
22323         CHECK_ACCESS(_res_ptr);
22324         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
22325         FREE(untag_ptr(_res));
22326         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
22327 }
22328
22329 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
22330         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22331         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
22332         return tag_ptr(ret_conv, true);
22333 }
22334 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
22335         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
22336         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
22337         return ret_conv;
22338 }
22339
22340 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
22341         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
22342         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22343         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
22344         return tag_ptr(ret_conv, true);
22345 }
22346
22347 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
22348         void* o_ptr = untag_ptr(o);
22349         CHECK_ACCESS(o_ptr);
22350         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
22351         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
22352         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22353         *ret_copy = COption_MonitorEventZ_some(o_conv);
22354         uint64_t ret_ref = tag_ptr(ret_copy, true);
22355         return ret_ref;
22356 }
22357
22358 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
22359         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22360         *ret_copy = COption_MonitorEventZ_none();
22361         uint64_t ret_ref = tag_ptr(ret_copy, true);
22362         return ret_ref;
22363 }
22364
22365 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
22366         if (!ptr_is_owned(_res)) return;
22367         void* _res_ptr = untag_ptr(_res);
22368         CHECK_ACCESS(_res_ptr);
22369         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
22370         FREE(untag_ptr(_res));
22371         COption_MonitorEventZ_free(_res_conv);
22372 }
22373
22374 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
22375         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22376         *ret_copy = COption_MonitorEventZ_clone(arg);
22377         uint64_t ret_ref = tag_ptr(ret_copy, true);
22378         return ret_ref;
22379 }
22380 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
22381         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
22382         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
22383         return ret_conv;
22384 }
22385
22386 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
22387         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
22388         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22389         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
22390         uint64_t ret_ref = tag_ptr(ret_copy, true);
22391         return ret_ref;
22392 }
22393
22394 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
22395         void* o_ptr = untag_ptr(o);
22396         CHECK_ACCESS(o_ptr);
22397         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
22398         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
22399         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22400         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
22401         return tag_ptr(ret_conv, true);
22402 }
22403
22404 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
22405         void* e_ptr = untag_ptr(e);
22406         CHECK_ACCESS(e_ptr);
22407         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22408         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22409         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22410         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
22411         return tag_ptr(ret_conv, true);
22412 }
22413
22414 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
22415         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
22416         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
22417         return ret_conv;
22418 }
22419
22420 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
22421         if (!ptr_is_owned(_res)) return;
22422         void* _res_ptr = untag_ptr(_res);
22423         CHECK_ACCESS(_res_ptr);
22424         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
22425         FREE(untag_ptr(_res));
22426         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
22427 }
22428
22429 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
22430         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22431         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
22432         return tag_ptr(ret_conv, true);
22433 }
22434 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
22435         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
22436         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
22437         return ret_conv;
22438 }
22439
22440 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
22441         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
22442         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22443         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
22444         return tag_ptr(ret_conv, true);
22445 }
22446
22447 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
22448         LDKHTLCUpdate o_conv;
22449         o_conv.inner = untag_ptr(o);
22450         o_conv.is_owned = ptr_is_owned(o);
22451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22452         o_conv = HTLCUpdate_clone(&o_conv);
22453         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22454         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
22455         return tag_ptr(ret_conv, true);
22456 }
22457
22458 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
22459         void* e_ptr = untag_ptr(e);
22460         CHECK_ACCESS(e_ptr);
22461         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22462         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22463         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22464         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
22465         return tag_ptr(ret_conv, true);
22466 }
22467
22468 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
22469         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
22470         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
22471         return ret_conv;
22472 }
22473
22474 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
22475         if (!ptr_is_owned(_res)) return;
22476         void* _res_ptr = untag_ptr(_res);
22477         CHECK_ACCESS(_res_ptr);
22478         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
22479         FREE(untag_ptr(_res));
22480         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
22481 }
22482
22483 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
22484         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22485         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
22486         return tag_ptr(ret_conv, true);
22487 }
22488 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
22489         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
22490         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
22491         return ret_conv;
22492 }
22493
22494 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
22495         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
22496         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22497         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
22498         return tag_ptr(ret_conv, true);
22499 }
22500
22501 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
22502         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22503         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
22504         return tag_ptr(ret_conv, true);
22505 }
22506 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
22507         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
22508         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
22509         return ret_conv;
22510 }
22511
22512 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
22513         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
22514         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22515         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
22516         return tag_ptr(ret_conv, true);
22517 }
22518
22519 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
22520         LDKOutPoint a_conv;
22521         a_conv.inner = untag_ptr(a);
22522         a_conv.is_owned = ptr_is_owned(a);
22523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22524         a_conv = OutPoint_clone(&a_conv);
22525         LDKCVec_u8Z b_ref;
22526         b_ref.datalen = b->arr_len;
22527         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
22528         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
22529         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22530         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
22531         return tag_ptr(ret_conv, true);
22532 }
22533
22534 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
22535         if (!ptr_is_owned(_res)) return;
22536         void* _res_ptr = untag_ptr(_res);
22537         CHECK_ACCESS(_res_ptr);
22538         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
22539         FREE(untag_ptr(_res));
22540         C2Tuple_OutPointScriptZ_free(_res_conv);
22541 }
22542
22543 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
22544         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22545         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
22546         return tag_ptr(ret_conv, true);
22547 }
22548 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
22549         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
22550         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
22551         return ret_conv;
22552 }
22553
22554 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
22555         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
22556         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22557         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
22558         return tag_ptr(ret_conv, true);
22559 }
22560
22561 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
22562         LDKCVec_u8Z b_ref;
22563         b_ref.datalen = b->arr_len;
22564         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
22565         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
22566         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22567         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
22568         return tag_ptr(ret_conv, true);
22569 }
22570
22571 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
22572         if (!ptr_is_owned(_res)) return;
22573         void* _res_ptr = untag_ptr(_res);
22574         CHECK_ACCESS(_res_ptr);
22575         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
22576         FREE(untag_ptr(_res));
22577         C2Tuple_u32ScriptZ_free(_res_conv);
22578 }
22579
22580 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
22581         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
22582         _res_constr.datalen = _res->arr_len;
22583         if (_res_constr.datalen > 0)
22584                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
22585         else
22586                 _res_constr.data = NULL;
22587         uint64_t* _res_vals = _res->elems;
22588         for (size_t v = 0; v < _res_constr.datalen; v++) {
22589                 uint64_t _res_conv_21 = _res_vals[v];
22590                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
22591                 CHECK_ACCESS(_res_conv_21_ptr);
22592                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
22593                 FREE(untag_ptr(_res_conv_21));
22594                 _res_constr.data[v] = _res_conv_21_conv;
22595         }
22596         FREE(_res);
22597         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
22598 }
22599
22600 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
22601         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22602         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
22603         return tag_ptr(ret_conv, true);
22604 }
22605 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
22606         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
22607         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
22608         return ret_conv;
22609 }
22610
22611 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
22612         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
22613         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22614         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
22615         return tag_ptr(ret_conv, true);
22616 }
22617
22618 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
22619         LDKThirtyTwoBytes a_ref;
22620         CHECK(a->arr_len == 32);
22621         memcpy(a_ref.data, a->elems, 32); FREE(a);
22622         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
22623         b_constr.datalen = b->arr_len;
22624         if (b_constr.datalen > 0)
22625                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
22626         else
22627                 b_constr.data = NULL;
22628         uint64_t* b_vals = b->elems;
22629         for (size_t v = 0; v < b_constr.datalen; v++) {
22630                 uint64_t b_conv_21 = b_vals[v];
22631                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
22632                 CHECK_ACCESS(b_conv_21_ptr);
22633                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
22634                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
22635                 b_constr.data[v] = b_conv_21_conv;
22636         }
22637         FREE(b);
22638         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22639         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
22640         return tag_ptr(ret_conv, true);
22641 }
22642
22643 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
22644         if (!ptr_is_owned(_res)) return;
22645         void* _res_ptr = untag_ptr(_res);
22646         CHECK_ACCESS(_res_ptr);
22647         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
22648         FREE(untag_ptr(_res));
22649         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
22650 }
22651
22652 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
22653         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
22654         _res_constr.datalen = _res->arr_len;
22655         if (_res_constr.datalen > 0)
22656                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
22657         else
22658                 _res_constr.data = NULL;
22659         uint64_t* _res_vals = _res->elems;
22660         for (size_t o = 0; o < _res_constr.datalen; o++) {
22661                 uint64_t _res_conv_40 = _res_vals[o];
22662                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22663                 CHECK_ACCESS(_res_conv_40_ptr);
22664                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
22665                 FREE(untag_ptr(_res_conv_40));
22666                 _res_constr.data[o] = _res_conv_40_conv;
22667         }
22668         FREE(_res);
22669         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
22670 }
22671
22672 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
22673         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22674         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
22675         return tag_ptr(ret_conv, true);
22676 }
22677 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
22678         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
22679         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
22680         return ret_conv;
22681 }
22682
22683 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
22684         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
22685         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22686         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
22687         return tag_ptr(ret_conv, true);
22688 }
22689
22690 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
22691         void* b_ptr = untag_ptr(b);
22692         CHECK_ACCESS(b_ptr);
22693         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
22694         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
22695         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22696         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
22697         return tag_ptr(ret_conv, true);
22698 }
22699
22700 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
22701         if (!ptr_is_owned(_res)) return;
22702         void* _res_ptr = untag_ptr(_res);
22703         CHECK_ACCESS(_res_ptr);
22704         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
22705         FREE(untag_ptr(_res));
22706         C2Tuple_u32TxOutZ_free(_res_conv);
22707 }
22708
22709 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
22710         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
22711         _res_constr.datalen = _res->arr_len;
22712         if (_res_constr.datalen > 0)
22713                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22714         else
22715                 _res_constr.data = NULL;
22716         uint64_t* _res_vals = _res->elems;
22717         for (size_t u = 0; u < _res_constr.datalen; u++) {
22718                 uint64_t _res_conv_20 = _res_vals[u];
22719                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
22720                 CHECK_ACCESS(_res_conv_20_ptr);
22721                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
22722                 FREE(untag_ptr(_res_conv_20));
22723                 _res_constr.data[u] = _res_conv_20_conv;
22724         }
22725         FREE(_res);
22726         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
22727 }
22728
22729 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
22730         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22731         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
22732         return tag_ptr(ret_conv, true);
22733 }
22734 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
22735         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
22736         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
22737         return ret_conv;
22738 }
22739
22740 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
22741         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
22742         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22743         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
22744         return tag_ptr(ret_conv, true);
22745 }
22746
22747 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
22748         LDKThirtyTwoBytes a_ref;
22749         CHECK(a->arr_len == 32);
22750         memcpy(a_ref.data, a->elems, 32); FREE(a);
22751         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
22752         b_constr.datalen = b->arr_len;
22753         if (b_constr.datalen > 0)
22754                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22755         else
22756                 b_constr.data = NULL;
22757         uint64_t* b_vals = b->elems;
22758         for (size_t u = 0; u < b_constr.datalen; u++) {
22759                 uint64_t b_conv_20 = b_vals[u];
22760                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
22761                 CHECK_ACCESS(b_conv_20_ptr);
22762                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
22763                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
22764                 b_constr.data[u] = b_conv_20_conv;
22765         }
22766         FREE(b);
22767         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22768         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
22769         return tag_ptr(ret_conv, true);
22770 }
22771
22772 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
22773         if (!ptr_is_owned(_res)) return;
22774         void* _res_ptr = untag_ptr(_res);
22775         CHECK_ACCESS(_res_ptr);
22776         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
22777         FREE(untag_ptr(_res));
22778         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
22779 }
22780
22781 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
22782         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
22783         _res_constr.datalen = _res->arr_len;
22784         if (_res_constr.datalen > 0)
22785                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
22786         else
22787                 _res_constr.data = NULL;
22788         uint64_t* _res_vals = _res->elems;
22789         for (size_t n = 0; n < _res_constr.datalen; n++) {
22790                 uint64_t _res_conv_39 = _res_vals[n];
22791                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
22792                 CHECK_ACCESS(_res_conv_39_ptr);
22793                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
22794                 FREE(untag_ptr(_res_conv_39));
22795                 _res_constr.data[n] = _res_conv_39_conv;
22796         }
22797         FREE(_res);
22798         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
22799 }
22800
22801 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
22802         LDKCVec_BalanceZ _res_constr;
22803         _res_constr.datalen = _res->arr_len;
22804         if (_res_constr.datalen > 0)
22805                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
22806         else
22807                 _res_constr.data = NULL;
22808         uint64_t* _res_vals = _res->elems;
22809         for (size_t j = 0; j < _res_constr.datalen; j++) {
22810                 uint64_t _res_conv_9 = _res_vals[j];
22811                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
22812                 CHECK_ACCESS(_res_conv_9_ptr);
22813                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
22814                 FREE(untag_ptr(_res_conv_9));
22815                 _res_constr.data[j] = _res_conv_9_conv;
22816         }
22817         FREE(_res);
22818         CVec_BalanceZ_free(_res_constr);
22819 }
22820
22821 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
22822         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
22823         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
22824         return tag_ptr(ret_conv, true);
22825 }
22826 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
22827         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
22828         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
22829         return ret_conv;
22830 }
22831
22832 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
22833         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
22834         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
22835         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
22836         return tag_ptr(ret_conv, true);
22837 }
22838
22839 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
22840         LDKThirtyTwoBytes a_ref;
22841         CHECK(a->arr_len == 32);
22842         memcpy(a_ref.data, a->elems, 32); FREE(a);
22843         LDKChannelMonitor b_conv;
22844         b_conv.inner = untag_ptr(b);
22845         b_conv.is_owned = ptr_is_owned(b);
22846         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22847         b_conv = ChannelMonitor_clone(&b_conv);
22848         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
22849         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
22850         return tag_ptr(ret_conv, true);
22851 }
22852
22853 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
22854         if (!ptr_is_owned(_res)) return;
22855         void* _res_ptr = untag_ptr(_res);
22856         CHECK_ACCESS(_res_ptr);
22857         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
22858         FREE(untag_ptr(_res));
22859         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
22860 }
22861
22862 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
22863         void* o_ptr = untag_ptr(o);
22864         CHECK_ACCESS(o_ptr);
22865         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
22866         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
22867         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22868         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
22869         return tag_ptr(ret_conv, true);
22870 }
22871
22872 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
22873         void* e_ptr = untag_ptr(e);
22874         CHECK_ACCESS(e_ptr);
22875         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22876         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22877         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22878         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
22879         return tag_ptr(ret_conv, true);
22880 }
22881
22882 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
22883         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
22884         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
22885         return ret_conv;
22886 }
22887
22888 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
22889         if (!ptr_is_owned(_res)) return;
22890         void* _res_ptr = untag_ptr(_res);
22891         CHECK_ACCESS(_res_ptr);
22892         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
22893         FREE(untag_ptr(_res));
22894         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
22895 }
22896
22897 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
22898         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22899         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
22900         return tag_ptr(ret_conv, true);
22901 }
22902 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
22903         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
22904         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
22905         return ret_conv;
22906 }
22907
22908 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
22909         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
22910         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22911         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
22912         return tag_ptr(ret_conv, true);
22913 }
22914
22915 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
22916         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22917         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
22918         return tag_ptr(ret_conv, true);
22919 }
22920 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
22921         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
22922         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
22923         return ret_conv;
22924 }
22925
22926 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
22927         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
22928         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22929         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
22930         return tag_ptr(ret_conv, true);
22931 }
22932
22933 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
22934         LDKPublicKey a_ref;
22935         CHECK(a->arr_len == 33);
22936         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
22937         void* b_ptr = untag_ptr(b);
22938         CHECK_ACCESS(b_ptr);
22939         LDKType b_conv = *(LDKType*)(b_ptr);
22940         if (b_conv.free == LDKType_JCalls_free) {
22941                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22942                 LDKType_JCalls_cloned(&b_conv);
22943         }
22944         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22945         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
22946         return tag_ptr(ret_conv, true);
22947 }
22948
22949 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
22950         if (!ptr_is_owned(_res)) return;
22951         void* _res_ptr = untag_ptr(_res);
22952         CHECK_ACCESS(_res_ptr);
22953         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
22954         FREE(untag_ptr(_res));
22955         C2Tuple_PublicKeyTypeZ_free(_res_conv);
22956 }
22957
22958 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
22959         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
22960         _res_constr.datalen = _res->arr_len;
22961         if (_res_constr.datalen > 0)
22962                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22963         else
22964                 _res_constr.data = NULL;
22965         uint64_t* _res_vals = _res->elems;
22966         for (size_t z = 0; z < _res_constr.datalen; z++) {
22967                 uint64_t _res_conv_25 = _res_vals[z];
22968                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
22969                 CHECK_ACCESS(_res_conv_25_ptr);
22970                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
22971                 FREE(untag_ptr(_res_conv_25));
22972                 _res_constr.data[z] = _res_conv_25_conv;
22973         }
22974         FREE(_res);
22975         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
22976 }
22977
22978 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
22979         void* o_ptr = untag_ptr(o);
22980         CHECK_ACCESS(o_ptr);
22981         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
22982         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
22983                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22984                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
22985         }
22986         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22987         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
22988         uint64_t ret_ref = tag_ptr(ret_copy, true);
22989         return ret_ref;
22990 }
22991
22992 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
22993         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22994         *ret_copy = COption_CustomOnionMessageContentsZ_none();
22995         uint64_t ret_ref = tag_ptr(ret_copy, true);
22996         return ret_ref;
22997 }
22998
22999 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
23000         if (!ptr_is_owned(_res)) return;
23001         void* _res_ptr = untag_ptr(_res);
23002         CHECK_ACCESS(_res_ptr);
23003         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
23004         FREE(untag_ptr(_res));
23005         COption_CustomOnionMessageContentsZ_free(_res_conv);
23006 }
23007
23008 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
23009         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
23010         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
23011         uint64_t ret_ref = tag_ptr(ret_copy, true);
23012         return ret_ref;
23013 }
23014 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
23015         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
23016         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
23017         return ret_conv;
23018 }
23019
23020 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
23021         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
23022         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
23023         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
23024         uint64_t ret_ref = tag_ptr(ret_copy, true);
23025         return ret_ref;
23026 }
23027
23028 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
23029         void* o_ptr = untag_ptr(o);
23030         CHECK_ACCESS(o_ptr);
23031         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
23032         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
23033         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23034         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
23035         return tag_ptr(ret_conv, true);
23036 }
23037
23038 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
23039         void* e_ptr = untag_ptr(e);
23040         CHECK_ACCESS(e_ptr);
23041         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23042         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23043         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23044         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
23045         return tag_ptr(ret_conv, true);
23046 }
23047
23048 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
23049         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
23050         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
23051         return ret_conv;
23052 }
23053
23054 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
23055         if (!ptr_is_owned(_res)) return;
23056         void* _res_ptr = untag_ptr(_res);
23057         CHECK_ACCESS(_res_ptr);
23058         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
23059         FREE(untag_ptr(_res));
23060         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
23061 }
23062
23063 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
23064         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23065         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
23066         return tag_ptr(ret_conv, true);
23067 }
23068 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
23069         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
23070         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
23071         return ret_conv;
23072 }
23073
23074 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
23075         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
23076         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23077         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
23078         return tag_ptr(ret_conv, true);
23079 }
23080
23081 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
23082         void* o_ptr = untag_ptr(o);
23083         CHECK_ACCESS(o_ptr);
23084         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
23085         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
23086         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23087         *ret_copy = COption_NetAddressZ_some(o_conv);
23088         uint64_t ret_ref = tag_ptr(ret_copy, true);
23089         return ret_ref;
23090 }
23091
23092 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
23093         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23094         *ret_copy = COption_NetAddressZ_none();
23095         uint64_t ret_ref = tag_ptr(ret_copy, true);
23096         return ret_ref;
23097 }
23098
23099 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
23100         if (!ptr_is_owned(_res)) return;
23101         void* _res_ptr = untag_ptr(_res);
23102         CHECK_ACCESS(_res_ptr);
23103         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
23104         FREE(untag_ptr(_res));
23105         COption_NetAddressZ_free(_res_conv);
23106 }
23107
23108 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
23109         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23110         *ret_copy = COption_NetAddressZ_clone(arg);
23111         uint64_t ret_ref = tag_ptr(ret_copy, true);
23112         return ret_ref;
23113 }
23114 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
23115         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
23116         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
23117         return ret_conv;
23118 }
23119
23120 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
23121         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
23122         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23123         *ret_copy = COption_NetAddressZ_clone(orig_conv);
23124         uint64_t ret_ref = tag_ptr(ret_copy, true);
23125         return ret_ref;
23126 }
23127
23128 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
23129         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23130         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
23131         return tag_ptr(ret_conv, true);
23132 }
23133 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) {
23134         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
23135         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
23136         return ret_conv;
23137 }
23138
23139 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) {
23140         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
23141         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23142         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
23143         return tag_ptr(ret_conv, true);
23144 }
23145
23146 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) {
23147         LDKPublicKey a_ref;
23148         CHECK(a->arr_len == 33);
23149         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
23150         void* b_ptr = untag_ptr(b);
23151         CHECK_ACCESS(b_ptr);
23152         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
23153         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
23154         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23155         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
23156         return tag_ptr(ret_conv, true);
23157 }
23158
23159 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) {
23160         if (!ptr_is_owned(_res)) return;
23161         void* _res_ptr = untag_ptr(_res);
23162         CHECK_ACCESS(_res_ptr);
23163         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
23164         FREE(untag_ptr(_res));
23165         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
23166 }
23167
23168 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) {
23169         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
23170         _res_constr.datalen = _res->arr_len;
23171         if (_res_constr.datalen > 0)
23172                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
23173         else
23174                 _res_constr.data = NULL;
23175         uint64_t* _res_vals = _res->elems;
23176         for (size_t o = 0; o < _res_constr.datalen; o++) {
23177                 uint64_t _res_conv_40 = _res_vals[o];
23178                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
23179                 CHECK_ACCESS(_res_conv_40_ptr);
23180                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
23181                 FREE(untag_ptr(_res_conv_40));
23182                 _res_constr.data[o] = _res_conv_40_conv;
23183         }
23184         FREE(_res);
23185         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
23186 }
23187
23188 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
23189         LDKCVec_u8Z o_ref;
23190         o_ref.datalen = o->arr_len;
23191         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
23192         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
23193         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23194         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
23195         return tag_ptr(ret_conv, true);
23196 }
23197
23198 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
23199         LDKPeerHandleError e_conv;
23200         e_conv.inner = untag_ptr(e);
23201         e_conv.is_owned = ptr_is_owned(e);
23202         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23203         e_conv = PeerHandleError_clone(&e_conv);
23204         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23205         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
23206         return tag_ptr(ret_conv, true);
23207 }
23208
23209 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
23210         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
23211         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
23212         return ret_conv;
23213 }
23214
23215 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
23216         if (!ptr_is_owned(_res)) return;
23217         void* _res_ptr = untag_ptr(_res);
23218         CHECK_ACCESS(_res_ptr);
23219         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
23220         FREE(untag_ptr(_res));
23221         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
23222 }
23223
23224 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
23225         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23226         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
23227         return tag_ptr(ret_conv, true);
23228 }
23229 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
23230         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
23231         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
23232         return ret_conv;
23233 }
23234
23235 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
23236         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
23237         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23238         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
23239         return tag_ptr(ret_conv, true);
23240 }
23241
23242 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
23243         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23244         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
23245         return tag_ptr(ret_conv, true);
23246 }
23247
23248 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
23249         LDKPeerHandleError e_conv;
23250         e_conv.inner = untag_ptr(e);
23251         e_conv.is_owned = ptr_is_owned(e);
23252         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23253         e_conv = PeerHandleError_clone(&e_conv);
23254         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23255         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
23256         return tag_ptr(ret_conv, true);
23257 }
23258
23259 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
23260         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
23261         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
23262         return ret_conv;
23263 }
23264
23265 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
23266         if (!ptr_is_owned(_res)) return;
23267         void* _res_ptr = untag_ptr(_res);
23268         CHECK_ACCESS(_res_ptr);
23269         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
23270         FREE(untag_ptr(_res));
23271         CResult_NonePeerHandleErrorZ_free(_res_conv);
23272 }
23273
23274 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
23275         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23276         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
23277         return tag_ptr(ret_conv, true);
23278 }
23279 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
23280         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
23281         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
23282         return ret_conv;
23283 }
23284
23285 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
23286         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
23287         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23288         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
23289         return tag_ptr(ret_conv, true);
23290 }
23291
23292 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
23293         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23294         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
23295         return tag_ptr(ret_conv, true);
23296 }
23297
23298 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
23299         LDKPeerHandleError e_conv;
23300         e_conv.inner = untag_ptr(e);
23301         e_conv.is_owned = ptr_is_owned(e);
23302         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23303         e_conv = PeerHandleError_clone(&e_conv);
23304         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23305         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
23306         return tag_ptr(ret_conv, true);
23307 }
23308
23309 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
23310         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
23311         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
23312         return ret_conv;
23313 }
23314
23315 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
23316         if (!ptr_is_owned(_res)) return;
23317         void* _res_ptr = untag_ptr(_res);
23318         CHECK_ACCESS(_res_ptr);
23319         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
23320         FREE(untag_ptr(_res));
23321         CResult_boolPeerHandleErrorZ_free(_res_conv);
23322 }
23323
23324 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
23325         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23326         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
23327         return tag_ptr(ret_conv, true);
23328 }
23329 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
23330         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
23331         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
23332         return ret_conv;
23333 }
23334
23335 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
23336         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
23337         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23338         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
23339         return tag_ptr(ret_conv, true);
23340 }
23341
23342 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
23343         void* o_ptr = untag_ptr(o);
23344         CHECK_ACCESS(o_ptr);
23345         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23346         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23347         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23348         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
23349         return tag_ptr(ret_conv, true);
23350 }
23351
23352 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
23353         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
23354         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23355         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
23356         return tag_ptr(ret_conv, true);
23357 }
23358
23359 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
23360         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
23361         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
23362         return ret_conv;
23363 }
23364
23365 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
23366         if (!ptr_is_owned(_res)) return;
23367         void* _res_ptr = untag_ptr(_res);
23368         CHECK_ACCESS(_res_ptr);
23369         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
23370         FREE(untag_ptr(_res));
23371         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
23372 }
23373
23374 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
23375         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23376         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
23377         return tag_ptr(ret_conv, true);
23378 }
23379 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
23380         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
23381         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
23382         return ret_conv;
23383 }
23384
23385 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
23386         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
23387         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23388         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
23389         return tag_ptr(ret_conv, true);
23390 }
23391
23392 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
23393         LDKOnionMessagePath o_conv;
23394         o_conv.inner = untag_ptr(o);
23395         o_conv.is_owned = ptr_is_owned(o);
23396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23397         o_conv = OnionMessagePath_clone(&o_conv);
23398         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
23399         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
23400         return tag_ptr(ret_conv, true);
23401 }
23402
23403 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
23404         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
23405         *ret_conv = CResult_OnionMessagePathNoneZ_err();
23406         return tag_ptr(ret_conv, true);
23407 }
23408
23409 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
23410         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
23411         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
23412         return ret_conv;
23413 }
23414
23415 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
23416         if (!ptr_is_owned(_res)) return;
23417         void* _res_ptr = untag_ptr(_res);
23418         CHECK_ACCESS(_res_ptr);
23419         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
23420         FREE(untag_ptr(_res));
23421         CResult_OnionMessagePathNoneZ_free(_res_conv);
23422 }
23423
23424 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
23425         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
23426         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
23427         return tag_ptr(ret_conv, true);
23428 }
23429 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
23430         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
23431         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
23432         return ret_conv;
23433 }
23434
23435 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
23436         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
23437         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
23438         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
23439         return tag_ptr(ret_conv, true);
23440 }
23441
23442 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
23443         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
23444         *ret_conv = CResult_NoneSendErrorZ_ok();
23445         return tag_ptr(ret_conv, true);
23446 }
23447
23448 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
23449         void* e_ptr = untag_ptr(e);
23450         CHECK_ACCESS(e_ptr);
23451         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
23452         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
23453         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
23454         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
23455         return tag_ptr(ret_conv, true);
23456 }
23457
23458 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
23459         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
23460         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
23461         return ret_conv;
23462 }
23463
23464 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
23465         if (!ptr_is_owned(_res)) return;
23466         void* _res_ptr = untag_ptr(_res);
23467         CHECK_ACCESS(_res_ptr);
23468         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
23469         FREE(untag_ptr(_res));
23470         CResult_NoneSendErrorZ_free(_res_conv);
23471 }
23472
23473 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
23474         LDKBlindedPath o_conv;
23475         o_conv.inner = untag_ptr(o);
23476         o_conv.is_owned = ptr_is_owned(o);
23477         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23478         o_conv = BlindedPath_clone(&o_conv);
23479         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
23480         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
23481         return tag_ptr(ret_conv, true);
23482 }
23483
23484 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
23485         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
23486         *ret_conv = CResult_BlindedPathNoneZ_err();
23487         return tag_ptr(ret_conv, true);
23488 }
23489
23490 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
23491         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
23492         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
23493         return ret_conv;
23494 }
23495
23496 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
23497         if (!ptr_is_owned(_res)) return;
23498         void* _res_ptr = untag_ptr(_res);
23499         CHECK_ACCESS(_res_ptr);
23500         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
23501         FREE(untag_ptr(_res));
23502         CResult_BlindedPathNoneZ_free(_res_conv);
23503 }
23504
23505 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
23506         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
23507         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
23508         return tag_ptr(ret_conv, true);
23509 }
23510 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
23511         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
23512         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
23513         return ret_conv;
23514 }
23515
23516 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
23517         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
23518         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
23519         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
23520         return tag_ptr(ret_conv, true);
23521 }
23522
23523 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
23524         LDKBlindedPath o_conv;
23525         o_conv.inner = untag_ptr(o);
23526         o_conv.is_owned = ptr_is_owned(o);
23527         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23528         o_conv = BlindedPath_clone(&o_conv);
23529         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
23530         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
23531         return tag_ptr(ret_conv, true);
23532 }
23533
23534 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
23535         void* e_ptr = untag_ptr(e);
23536         CHECK_ACCESS(e_ptr);
23537         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23538         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23539         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
23540         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
23541         return tag_ptr(ret_conv, true);
23542 }
23543
23544 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
23545         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
23546         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
23547         return ret_conv;
23548 }
23549
23550 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
23551         if (!ptr_is_owned(_res)) return;
23552         void* _res_ptr = untag_ptr(_res);
23553         CHECK_ACCESS(_res_ptr);
23554         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
23555         FREE(untag_ptr(_res));
23556         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
23557 }
23558
23559 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
23560         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
23561         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
23562         return tag_ptr(ret_conv, true);
23563 }
23564 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
23565         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
23566         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
23567         return ret_conv;
23568 }
23569
23570 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
23571         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
23572         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
23573         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
23574         return tag_ptr(ret_conv, true);
23575 }
23576
23577 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
23578         LDKBlindedHop o_conv;
23579         o_conv.inner = untag_ptr(o);
23580         o_conv.is_owned = ptr_is_owned(o);
23581         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23582         o_conv = BlindedHop_clone(&o_conv);
23583         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
23584         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
23585         return tag_ptr(ret_conv, true);
23586 }
23587
23588 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
23589         void* e_ptr = untag_ptr(e);
23590         CHECK_ACCESS(e_ptr);
23591         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23592         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23593         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
23594         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
23595         return tag_ptr(ret_conv, true);
23596 }
23597
23598 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
23599         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
23600         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
23601         return ret_conv;
23602 }
23603
23604 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
23605         if (!ptr_is_owned(_res)) return;
23606         void* _res_ptr = untag_ptr(_res);
23607         CHECK_ACCESS(_res_ptr);
23608         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
23609         FREE(untag_ptr(_res));
23610         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
23611 }
23612
23613 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
23614         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
23615         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
23616         return tag_ptr(ret_conv, true);
23617 }
23618 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
23619         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
23620         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
23621         return ret_conv;
23622 }
23623
23624 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
23625         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
23626         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
23627         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
23628         return tag_ptr(ret_conv, true);
23629 }
23630
23631 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
23632         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
23633         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
23634         return tag_ptr(ret_conv, true);
23635 }
23636
23637 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
23638         void* e_ptr = untag_ptr(e);
23639         CHECK_ACCESS(e_ptr);
23640         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
23641         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
23642         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
23643         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
23644         return tag_ptr(ret_conv, true);
23645 }
23646
23647 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
23648         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
23649         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
23650         return ret_conv;
23651 }
23652
23653 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
23654         if (!ptr_is_owned(_res)) return;
23655         void* _res_ptr = untag_ptr(_res);
23656         CHECK_ACCESS(_res_ptr);
23657         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
23658         FREE(untag_ptr(_res));
23659         CResult_u32GraphSyncErrorZ_free(_res_conv);
23660 }
23661
23662 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
23663         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23664         *ret_conv = CResult_NoneErrorZ_ok();
23665         return tag_ptr(ret_conv, true);
23666 }
23667
23668 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
23669         LDKIOError e_conv = LDKIOError_from_js(e);
23670         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23671         *ret_conv = CResult_NoneErrorZ_err(e_conv);
23672         return tag_ptr(ret_conv, true);
23673 }
23674
23675 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
23676         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
23677         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
23678         return ret_conv;
23679 }
23680
23681 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
23682         if (!ptr_is_owned(_res)) return;
23683         void* _res_ptr = untag_ptr(_res);
23684         CHECK_ACCESS(_res_ptr);
23685         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
23686         FREE(untag_ptr(_res));
23687         CResult_NoneErrorZ_free(_res_conv);
23688 }
23689
23690 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
23691         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23692         *ret_conv = CResult_NoneErrorZ_clone(arg);
23693         return tag_ptr(ret_conv, true);
23694 }
23695 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
23696         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
23697         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
23698         return ret_conv;
23699 }
23700
23701 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
23702         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
23703         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23704         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
23705         return tag_ptr(ret_conv, true);
23706 }
23707
23708 uint64_t  __attribute__((export_name("TS_COption_ScriptZ_some"))) TS_COption_ScriptZ_some(int8_tArray o) {
23709         LDKCVec_u8Z o_ref;
23710         o_ref.datalen = o->arr_len;
23711         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
23712         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
23713         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
23714         *ret_copy = COption_ScriptZ_some(o_ref);
23715         uint64_t ret_ref = tag_ptr(ret_copy, true);
23716         return ret_ref;
23717 }
23718
23719 uint64_t  __attribute__((export_name("TS_COption_ScriptZ_none"))) TS_COption_ScriptZ_none() {
23720         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
23721         *ret_copy = COption_ScriptZ_none();
23722         uint64_t ret_ref = tag_ptr(ret_copy, true);
23723         return ret_ref;
23724 }
23725
23726 void  __attribute__((export_name("TS_COption_ScriptZ_free"))) TS_COption_ScriptZ_free(uint64_t _res) {
23727         if (!ptr_is_owned(_res)) return;
23728         void* _res_ptr = untag_ptr(_res);
23729         CHECK_ACCESS(_res_ptr);
23730         LDKCOption_ScriptZ _res_conv = *(LDKCOption_ScriptZ*)(_res_ptr);
23731         FREE(untag_ptr(_res));
23732         COption_ScriptZ_free(_res_conv);
23733 }
23734
23735 static inline uint64_t COption_ScriptZ_clone_ptr(LDKCOption_ScriptZ *NONNULL_PTR arg) {
23736         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
23737         *ret_copy = COption_ScriptZ_clone(arg);
23738         uint64_t ret_ref = tag_ptr(ret_copy, true);
23739         return ret_ref;
23740 }
23741 int64_t  __attribute__((export_name("TS_COption_ScriptZ_clone_ptr"))) TS_COption_ScriptZ_clone_ptr(uint64_t arg) {
23742         LDKCOption_ScriptZ* arg_conv = (LDKCOption_ScriptZ*)untag_ptr(arg);
23743         int64_t ret_conv = COption_ScriptZ_clone_ptr(arg_conv);
23744         return ret_conv;
23745 }
23746
23747 uint64_t  __attribute__((export_name("TS_COption_ScriptZ_clone"))) TS_COption_ScriptZ_clone(uint64_t orig) {
23748         LDKCOption_ScriptZ* orig_conv = (LDKCOption_ScriptZ*)untag_ptr(orig);
23749         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
23750         *ret_copy = COption_ScriptZ_clone(orig_conv);
23751         uint64_t ret_ref = tag_ptr(ret_copy, true);
23752         return ret_ref;
23753 }
23754
23755 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
23756         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
23757         return ret_conv;
23758 }
23759
23760 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
23761         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
23762         return ret_conv;
23763 }
23764
23765 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
23766         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
23767         COption_NoneZ_free(_res_conv);
23768 }
23769
23770 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
23771         LDKCVec_WitnessZ _res_constr;
23772         _res_constr.datalen = _res->arr_len;
23773         if (_res_constr.datalen > 0)
23774                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
23775         else
23776                 _res_constr.data = NULL;
23777         int8_tArray* _res_vals = (void*) _res->elems;
23778         for (size_t m = 0; m < _res_constr.datalen; m++) {
23779                 int8_tArray _res_conv_12 = _res_vals[m];
23780                 LDKWitness _res_conv_12_ref;
23781                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
23782                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
23783                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
23784                 _res_conv_12_ref.data_is_owned = true;
23785                 _res_constr.data[m] = _res_conv_12_ref;
23786         }
23787         FREE(_res);
23788         CVec_WitnessZ_free(_res_constr);
23789 }
23790
23791 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
23792         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23793         *ret_copy = COption_i64Z_some(o);
23794         uint64_t ret_ref = tag_ptr(ret_copy, true);
23795         return ret_ref;
23796 }
23797
23798 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
23799         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23800         *ret_copy = COption_i64Z_none();
23801         uint64_t ret_ref = tag_ptr(ret_copy, true);
23802         return ret_ref;
23803 }
23804
23805 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
23806         if (!ptr_is_owned(_res)) return;
23807         void* _res_ptr = untag_ptr(_res);
23808         CHECK_ACCESS(_res_ptr);
23809         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
23810         FREE(untag_ptr(_res));
23811         COption_i64Z_free(_res_conv);
23812 }
23813
23814 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
23815         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23816         *ret_copy = COption_i64Z_clone(arg);
23817         uint64_t ret_ref = tag_ptr(ret_copy, true);
23818         return ret_ref;
23819 }
23820 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
23821         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
23822         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
23823         return ret_conv;
23824 }
23825
23826 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
23827         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
23828         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23829         *ret_copy = COption_i64Z_clone(orig_conv);
23830         uint64_t ret_ref = tag_ptr(ret_copy, true);
23831         return ret_ref;
23832 }
23833
23834 uint64_t  __attribute__((export_name("TS_COption_TxidZ_some"))) TS_COption_TxidZ_some(int8_tArray o) {
23835         LDKThirtyTwoBytes o_ref;
23836         CHECK(o->arr_len == 32);
23837         memcpy(o_ref.data, o->elems, 32); FREE(o);
23838         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
23839         *ret_copy = COption_TxidZ_some(o_ref);
23840         uint64_t ret_ref = tag_ptr(ret_copy, true);
23841         return ret_ref;
23842 }
23843
23844 uint64_t  __attribute__((export_name("TS_COption_TxidZ_none"))) TS_COption_TxidZ_none() {
23845         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
23846         *ret_copy = COption_TxidZ_none();
23847         uint64_t ret_ref = tag_ptr(ret_copy, true);
23848         return ret_ref;
23849 }
23850
23851 void  __attribute__((export_name("TS_COption_TxidZ_free"))) TS_COption_TxidZ_free(uint64_t _res) {
23852         if (!ptr_is_owned(_res)) return;
23853         void* _res_ptr = untag_ptr(_res);
23854         CHECK_ACCESS(_res_ptr);
23855         LDKCOption_TxidZ _res_conv = *(LDKCOption_TxidZ*)(_res_ptr);
23856         FREE(untag_ptr(_res));
23857         COption_TxidZ_free(_res_conv);
23858 }
23859
23860 static inline uint64_t COption_TxidZ_clone_ptr(LDKCOption_TxidZ *NONNULL_PTR arg) {
23861         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
23862         *ret_copy = COption_TxidZ_clone(arg);
23863         uint64_t ret_ref = tag_ptr(ret_copy, true);
23864         return ret_ref;
23865 }
23866 int64_t  __attribute__((export_name("TS_COption_TxidZ_clone_ptr"))) TS_COption_TxidZ_clone_ptr(uint64_t arg) {
23867         LDKCOption_TxidZ* arg_conv = (LDKCOption_TxidZ*)untag_ptr(arg);
23868         int64_t ret_conv = COption_TxidZ_clone_ptr(arg_conv);
23869         return ret_conv;
23870 }
23871
23872 uint64_t  __attribute__((export_name("TS_COption_TxidZ_clone"))) TS_COption_TxidZ_clone(uint64_t orig) {
23873         LDKCOption_TxidZ* orig_conv = (LDKCOption_TxidZ*)untag_ptr(orig);
23874         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
23875         *ret_copy = COption_TxidZ_clone(orig_conv);
23876         uint64_t ret_ref = tag_ptr(ret_copy, true);
23877         return ret_ref;
23878 }
23879
23880 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
23881         void* o_ptr = untag_ptr(o);
23882         CHECK_ACCESS(o_ptr);
23883         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
23884         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
23885         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23886         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
23887         return tag_ptr(ret_conv, true);
23888 }
23889
23890 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
23891         void* e_ptr = untag_ptr(e);
23892         CHECK_ACCESS(e_ptr);
23893         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23894         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23895         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23896         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
23897         return tag_ptr(ret_conv, true);
23898 }
23899
23900 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
23901         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
23902         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
23903         return ret_conv;
23904 }
23905
23906 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
23907         if (!ptr_is_owned(_res)) return;
23908         void* _res_ptr = untag_ptr(_res);
23909         CHECK_ACCESS(_res_ptr);
23910         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
23911         FREE(untag_ptr(_res));
23912         CResult_NetAddressDecodeErrorZ_free(_res_conv);
23913 }
23914
23915 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
23916         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23917         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
23918         return tag_ptr(ret_conv, true);
23919 }
23920 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
23921         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
23922         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
23923         return ret_conv;
23924 }
23925
23926 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
23927         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
23928         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23929         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
23930         return tag_ptr(ret_conv, true);
23931 }
23932
23933 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
23934         LDKCVec_UpdateAddHTLCZ _res_constr;
23935         _res_constr.datalen = _res->arr_len;
23936         if (_res_constr.datalen > 0)
23937                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23938         else
23939                 _res_constr.data = NULL;
23940         uint64_t* _res_vals = _res->elems;
23941         for (size_t p = 0; p < _res_constr.datalen; p++) {
23942                 uint64_t _res_conv_15 = _res_vals[p];
23943                 LDKUpdateAddHTLC _res_conv_15_conv;
23944                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
23945                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
23946                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
23947                 _res_constr.data[p] = _res_conv_15_conv;
23948         }
23949         FREE(_res);
23950         CVec_UpdateAddHTLCZ_free(_res_constr);
23951 }
23952
23953 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
23954         LDKCVec_UpdateFulfillHTLCZ _res_constr;
23955         _res_constr.datalen = _res->arr_len;
23956         if (_res_constr.datalen > 0)
23957                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23958         else
23959                 _res_constr.data = NULL;
23960         uint64_t* _res_vals = _res->elems;
23961         for (size_t t = 0; t < _res_constr.datalen; t++) {
23962                 uint64_t _res_conv_19 = _res_vals[t];
23963                 LDKUpdateFulfillHTLC _res_conv_19_conv;
23964                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
23965                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
23966                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23967                 _res_constr.data[t] = _res_conv_19_conv;
23968         }
23969         FREE(_res);
23970         CVec_UpdateFulfillHTLCZ_free(_res_constr);
23971 }
23972
23973 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
23974         LDKCVec_UpdateFailHTLCZ _res_constr;
23975         _res_constr.datalen = _res->arr_len;
23976         if (_res_constr.datalen > 0)
23977                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23978         else
23979                 _res_constr.data = NULL;
23980         uint64_t* _res_vals = _res->elems;
23981         for (size_t q = 0; q < _res_constr.datalen; q++) {
23982                 uint64_t _res_conv_16 = _res_vals[q];
23983                 LDKUpdateFailHTLC _res_conv_16_conv;
23984                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23985                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23986                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23987                 _res_constr.data[q] = _res_conv_16_conv;
23988         }
23989         FREE(_res);
23990         CVec_UpdateFailHTLCZ_free(_res_constr);
23991 }
23992
23993 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
23994         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
23995         _res_constr.datalen = _res->arr_len;
23996         if (_res_constr.datalen > 0)
23997                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23998         else
23999                 _res_constr.data = NULL;
24000         uint64_t* _res_vals = _res->elems;
24001         for (size_t z = 0; z < _res_constr.datalen; z++) {
24002                 uint64_t _res_conv_25 = _res_vals[z];
24003                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
24004                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
24005                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
24006                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
24007                 _res_constr.data[z] = _res_conv_25_conv;
24008         }
24009         FREE(_res);
24010         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
24011 }
24012
24013 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
24014         LDKAcceptChannel o_conv;
24015         o_conv.inner = untag_ptr(o);
24016         o_conv.is_owned = ptr_is_owned(o);
24017         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24018         o_conv = AcceptChannel_clone(&o_conv);
24019         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24020         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
24021         return tag_ptr(ret_conv, true);
24022 }
24023
24024 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
24025         void* e_ptr = untag_ptr(e);
24026         CHECK_ACCESS(e_ptr);
24027         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24028         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24029         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24030         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
24031         return tag_ptr(ret_conv, true);
24032 }
24033
24034 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
24035         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
24036         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
24037         return ret_conv;
24038 }
24039
24040 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
24041         if (!ptr_is_owned(_res)) return;
24042         void* _res_ptr = untag_ptr(_res);
24043         CHECK_ACCESS(_res_ptr);
24044         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
24045         FREE(untag_ptr(_res));
24046         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
24047 }
24048
24049 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
24050         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24051         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
24052         return tag_ptr(ret_conv, true);
24053 }
24054 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
24055         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
24056         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
24057         return ret_conv;
24058 }
24059
24060 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
24061         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
24062         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24063         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
24064         return tag_ptr(ret_conv, true);
24065 }
24066
24067 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
24068         LDKAcceptChannelV2 o_conv;
24069         o_conv.inner = untag_ptr(o);
24070         o_conv.is_owned = ptr_is_owned(o);
24071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24072         o_conv = AcceptChannelV2_clone(&o_conv);
24073         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
24074         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
24075         return tag_ptr(ret_conv, true);
24076 }
24077
24078 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
24079         void* e_ptr = untag_ptr(e);
24080         CHECK_ACCESS(e_ptr);
24081         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24082         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24083         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
24084         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
24085         return tag_ptr(ret_conv, true);
24086 }
24087
24088 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
24089         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
24090         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
24091         return ret_conv;
24092 }
24093
24094 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
24095         if (!ptr_is_owned(_res)) return;
24096         void* _res_ptr = untag_ptr(_res);
24097         CHECK_ACCESS(_res_ptr);
24098         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
24099         FREE(untag_ptr(_res));
24100         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
24101 }
24102
24103 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
24104         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
24105         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
24106         return tag_ptr(ret_conv, true);
24107 }
24108 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
24109         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
24110         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
24111         return ret_conv;
24112 }
24113
24114 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
24115         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
24116         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
24117         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
24118         return tag_ptr(ret_conv, true);
24119 }
24120
24121 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
24122         LDKTxAddInput o_conv;
24123         o_conv.inner = untag_ptr(o);
24124         o_conv.is_owned = ptr_is_owned(o);
24125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24126         o_conv = TxAddInput_clone(&o_conv);
24127         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
24128         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
24129         return tag_ptr(ret_conv, true);
24130 }
24131
24132 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
24133         void* e_ptr = untag_ptr(e);
24134         CHECK_ACCESS(e_ptr);
24135         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24136         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24137         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
24138         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
24139         return tag_ptr(ret_conv, true);
24140 }
24141
24142 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
24143         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
24144         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
24145         return ret_conv;
24146 }
24147
24148 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
24149         if (!ptr_is_owned(_res)) return;
24150         void* _res_ptr = untag_ptr(_res);
24151         CHECK_ACCESS(_res_ptr);
24152         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
24153         FREE(untag_ptr(_res));
24154         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
24155 }
24156
24157 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
24158         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
24159         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
24160         return tag_ptr(ret_conv, true);
24161 }
24162 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
24163         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
24164         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
24165         return ret_conv;
24166 }
24167
24168 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
24169         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
24170         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
24171         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
24172         return tag_ptr(ret_conv, true);
24173 }
24174
24175 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
24176         LDKTxAddOutput o_conv;
24177         o_conv.inner = untag_ptr(o);
24178         o_conv.is_owned = ptr_is_owned(o);
24179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24180         o_conv = TxAddOutput_clone(&o_conv);
24181         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
24182         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
24183         return tag_ptr(ret_conv, true);
24184 }
24185
24186 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
24187         void* e_ptr = untag_ptr(e);
24188         CHECK_ACCESS(e_ptr);
24189         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24190         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24191         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
24192         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
24193         return tag_ptr(ret_conv, true);
24194 }
24195
24196 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
24197         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
24198         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
24199         return ret_conv;
24200 }
24201
24202 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
24203         if (!ptr_is_owned(_res)) return;
24204         void* _res_ptr = untag_ptr(_res);
24205         CHECK_ACCESS(_res_ptr);
24206         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
24207         FREE(untag_ptr(_res));
24208         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
24209 }
24210
24211 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
24212         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
24213         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
24214         return tag_ptr(ret_conv, true);
24215 }
24216 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
24217         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
24218         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
24219         return ret_conv;
24220 }
24221
24222 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
24223         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
24224         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
24225         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
24226         return tag_ptr(ret_conv, true);
24227 }
24228
24229 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
24230         LDKTxRemoveInput o_conv;
24231         o_conv.inner = untag_ptr(o);
24232         o_conv.is_owned = ptr_is_owned(o);
24233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24234         o_conv = TxRemoveInput_clone(&o_conv);
24235         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
24236         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
24237         return tag_ptr(ret_conv, true);
24238 }
24239
24240 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
24241         void* e_ptr = untag_ptr(e);
24242         CHECK_ACCESS(e_ptr);
24243         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24244         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24245         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
24246         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
24247         return tag_ptr(ret_conv, true);
24248 }
24249
24250 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
24251         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
24252         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
24253         return ret_conv;
24254 }
24255
24256 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
24257         if (!ptr_is_owned(_res)) return;
24258         void* _res_ptr = untag_ptr(_res);
24259         CHECK_ACCESS(_res_ptr);
24260         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
24261         FREE(untag_ptr(_res));
24262         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
24263 }
24264
24265 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
24266         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
24267         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
24268         return tag_ptr(ret_conv, true);
24269 }
24270 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
24271         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
24272         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
24273         return ret_conv;
24274 }
24275
24276 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
24277         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
24278         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
24279         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
24280         return tag_ptr(ret_conv, true);
24281 }
24282
24283 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
24284         LDKTxRemoveOutput o_conv;
24285         o_conv.inner = untag_ptr(o);
24286         o_conv.is_owned = ptr_is_owned(o);
24287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24288         o_conv = TxRemoveOutput_clone(&o_conv);
24289         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
24290         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
24291         return tag_ptr(ret_conv, true);
24292 }
24293
24294 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
24295         void* e_ptr = untag_ptr(e);
24296         CHECK_ACCESS(e_ptr);
24297         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24298         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24299         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
24300         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
24301         return tag_ptr(ret_conv, true);
24302 }
24303
24304 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
24305         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
24306         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
24307         return ret_conv;
24308 }
24309
24310 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
24311         if (!ptr_is_owned(_res)) return;
24312         void* _res_ptr = untag_ptr(_res);
24313         CHECK_ACCESS(_res_ptr);
24314         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
24315         FREE(untag_ptr(_res));
24316         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
24317 }
24318
24319 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
24320         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
24321         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
24322         return tag_ptr(ret_conv, true);
24323 }
24324 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
24325         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
24326         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
24327         return ret_conv;
24328 }
24329
24330 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
24331         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
24332         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
24333         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
24334         return tag_ptr(ret_conv, true);
24335 }
24336
24337 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
24338         LDKTxComplete o_conv;
24339         o_conv.inner = untag_ptr(o);
24340         o_conv.is_owned = ptr_is_owned(o);
24341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24342         o_conv = TxComplete_clone(&o_conv);
24343         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24344         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
24345         return tag_ptr(ret_conv, true);
24346 }
24347
24348 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
24349         void* e_ptr = untag_ptr(e);
24350         CHECK_ACCESS(e_ptr);
24351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24353         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24354         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
24355         return tag_ptr(ret_conv, true);
24356 }
24357
24358 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
24359         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
24360         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
24361         return ret_conv;
24362 }
24363
24364 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
24365         if (!ptr_is_owned(_res)) return;
24366         void* _res_ptr = untag_ptr(_res);
24367         CHECK_ACCESS(_res_ptr);
24368         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
24369         FREE(untag_ptr(_res));
24370         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
24371 }
24372
24373 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
24374         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24375         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
24376         return tag_ptr(ret_conv, true);
24377 }
24378 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
24379         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
24380         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
24381         return ret_conv;
24382 }
24383
24384 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
24385         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
24386         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24387         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
24388         return tag_ptr(ret_conv, true);
24389 }
24390
24391 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
24392         LDKTxSignatures o_conv;
24393         o_conv.inner = untag_ptr(o);
24394         o_conv.is_owned = ptr_is_owned(o);
24395         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24396         o_conv = TxSignatures_clone(&o_conv);
24397         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24398         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
24399         return tag_ptr(ret_conv, true);
24400 }
24401
24402 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
24403         void* e_ptr = untag_ptr(e);
24404         CHECK_ACCESS(e_ptr);
24405         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24406         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24407         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24408         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
24409         return tag_ptr(ret_conv, true);
24410 }
24411
24412 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
24413         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
24414         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
24415         return ret_conv;
24416 }
24417
24418 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
24419         if (!ptr_is_owned(_res)) return;
24420         void* _res_ptr = untag_ptr(_res);
24421         CHECK_ACCESS(_res_ptr);
24422         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
24423         FREE(untag_ptr(_res));
24424         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
24425 }
24426
24427 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24428         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24429         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
24430         return tag_ptr(ret_conv, true);
24431 }
24432 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
24433         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
24434         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24435         return ret_conv;
24436 }
24437
24438 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
24439         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
24440         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24441         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
24442         return tag_ptr(ret_conv, true);
24443 }
24444
24445 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
24446         LDKTxInitRbf o_conv;
24447         o_conv.inner = untag_ptr(o);
24448         o_conv.is_owned = ptr_is_owned(o);
24449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24450         o_conv = TxInitRbf_clone(&o_conv);
24451         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24452         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
24453         return tag_ptr(ret_conv, true);
24454 }
24455
24456 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
24457         void* e_ptr = untag_ptr(e);
24458         CHECK_ACCESS(e_ptr);
24459         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24460         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24461         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24462         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
24463         return tag_ptr(ret_conv, true);
24464 }
24465
24466 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
24467         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
24468         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
24469         return ret_conv;
24470 }
24471
24472 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
24473         if (!ptr_is_owned(_res)) return;
24474         void* _res_ptr = untag_ptr(_res);
24475         CHECK_ACCESS(_res_ptr);
24476         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
24477         FREE(untag_ptr(_res));
24478         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
24479 }
24480
24481 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
24482         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24483         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
24484         return tag_ptr(ret_conv, true);
24485 }
24486 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
24487         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
24488         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
24489         return ret_conv;
24490 }
24491
24492 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
24493         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
24494         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24495         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
24496         return tag_ptr(ret_conv, true);
24497 }
24498
24499 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
24500         LDKTxAckRbf o_conv;
24501         o_conv.inner = untag_ptr(o);
24502         o_conv.is_owned = ptr_is_owned(o);
24503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24504         o_conv = TxAckRbf_clone(&o_conv);
24505         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24506         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
24507         return tag_ptr(ret_conv, true);
24508 }
24509
24510 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
24511         void* e_ptr = untag_ptr(e);
24512         CHECK_ACCESS(e_ptr);
24513         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24514         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24515         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24516         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
24517         return tag_ptr(ret_conv, true);
24518 }
24519
24520 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
24521         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
24522         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
24523         return ret_conv;
24524 }
24525
24526 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
24527         if (!ptr_is_owned(_res)) return;
24528         void* _res_ptr = untag_ptr(_res);
24529         CHECK_ACCESS(_res_ptr);
24530         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
24531         FREE(untag_ptr(_res));
24532         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
24533 }
24534
24535 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
24536         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24537         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
24538         return tag_ptr(ret_conv, true);
24539 }
24540 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
24541         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
24542         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
24543         return ret_conv;
24544 }
24545
24546 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
24547         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
24548         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24549         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
24550         return tag_ptr(ret_conv, true);
24551 }
24552
24553 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
24554         LDKTxAbort o_conv;
24555         o_conv.inner = untag_ptr(o);
24556         o_conv.is_owned = ptr_is_owned(o);
24557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24558         o_conv = TxAbort_clone(&o_conv);
24559         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24560         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
24561         return tag_ptr(ret_conv, true);
24562 }
24563
24564 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
24565         void* e_ptr = untag_ptr(e);
24566         CHECK_ACCESS(e_ptr);
24567         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24568         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24569         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24570         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
24571         return tag_ptr(ret_conv, true);
24572 }
24573
24574 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
24575         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
24576         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
24577         return ret_conv;
24578 }
24579
24580 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
24581         if (!ptr_is_owned(_res)) return;
24582         void* _res_ptr = untag_ptr(_res);
24583         CHECK_ACCESS(_res_ptr);
24584         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
24585         FREE(untag_ptr(_res));
24586         CResult_TxAbortDecodeErrorZ_free(_res_conv);
24587 }
24588
24589 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
24590         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24591         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
24592         return tag_ptr(ret_conv, true);
24593 }
24594 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
24595         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
24596         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
24597         return ret_conv;
24598 }
24599
24600 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
24601         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
24602         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24603         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
24604         return tag_ptr(ret_conv, true);
24605 }
24606
24607 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
24608         LDKAnnouncementSignatures o_conv;
24609         o_conv.inner = untag_ptr(o);
24610         o_conv.is_owned = ptr_is_owned(o);
24611         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24612         o_conv = AnnouncementSignatures_clone(&o_conv);
24613         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24614         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
24615         return tag_ptr(ret_conv, true);
24616 }
24617
24618 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
24619         void* e_ptr = untag_ptr(e);
24620         CHECK_ACCESS(e_ptr);
24621         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24622         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24623         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24624         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
24625         return tag_ptr(ret_conv, true);
24626 }
24627
24628 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
24629         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
24630         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
24631         return ret_conv;
24632 }
24633
24634 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
24635         if (!ptr_is_owned(_res)) return;
24636         void* _res_ptr = untag_ptr(_res);
24637         CHECK_ACCESS(_res_ptr);
24638         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
24639         FREE(untag_ptr(_res));
24640         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
24641 }
24642
24643 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24644         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24645         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
24646         return tag_ptr(ret_conv, true);
24647 }
24648 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
24649         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
24650         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24651         return ret_conv;
24652 }
24653
24654 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
24655         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
24656         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24657         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
24658         return tag_ptr(ret_conv, true);
24659 }
24660
24661 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
24662         LDKChannelReestablish o_conv;
24663         o_conv.inner = untag_ptr(o);
24664         o_conv.is_owned = ptr_is_owned(o);
24665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24666         o_conv = ChannelReestablish_clone(&o_conv);
24667         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24668         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
24669         return tag_ptr(ret_conv, true);
24670 }
24671
24672 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
24673         void* e_ptr = untag_ptr(e);
24674         CHECK_ACCESS(e_ptr);
24675         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24676         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24677         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24678         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
24679         return tag_ptr(ret_conv, true);
24680 }
24681
24682 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
24683         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
24684         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
24685         return ret_conv;
24686 }
24687
24688 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
24689         if (!ptr_is_owned(_res)) return;
24690         void* _res_ptr = untag_ptr(_res);
24691         CHECK_ACCESS(_res_ptr);
24692         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
24693         FREE(untag_ptr(_res));
24694         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
24695 }
24696
24697 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
24698         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24699         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
24700         return tag_ptr(ret_conv, true);
24701 }
24702 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
24703         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
24704         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
24705         return ret_conv;
24706 }
24707
24708 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
24709         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
24710         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24711         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
24712         return tag_ptr(ret_conv, true);
24713 }
24714
24715 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
24716         LDKClosingSigned o_conv;
24717         o_conv.inner = untag_ptr(o);
24718         o_conv.is_owned = ptr_is_owned(o);
24719         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24720         o_conv = ClosingSigned_clone(&o_conv);
24721         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24722         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
24723         return tag_ptr(ret_conv, true);
24724 }
24725
24726 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
24727         void* e_ptr = untag_ptr(e);
24728         CHECK_ACCESS(e_ptr);
24729         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24730         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24731         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24732         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
24733         return tag_ptr(ret_conv, true);
24734 }
24735
24736 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
24737         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
24738         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
24739         return ret_conv;
24740 }
24741
24742 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
24743         if (!ptr_is_owned(_res)) return;
24744         void* _res_ptr = untag_ptr(_res);
24745         CHECK_ACCESS(_res_ptr);
24746         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
24747         FREE(untag_ptr(_res));
24748         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
24749 }
24750
24751 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
24752         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24753         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
24754         return tag_ptr(ret_conv, true);
24755 }
24756 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24757         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
24758         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
24759         return ret_conv;
24760 }
24761
24762 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
24763         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
24764         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24765         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
24766         return tag_ptr(ret_conv, true);
24767 }
24768
24769 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
24770         LDKClosingSignedFeeRange o_conv;
24771         o_conv.inner = untag_ptr(o);
24772         o_conv.is_owned = ptr_is_owned(o);
24773         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24774         o_conv = ClosingSignedFeeRange_clone(&o_conv);
24775         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24776         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
24777         return tag_ptr(ret_conv, true);
24778 }
24779
24780 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
24781         void* e_ptr = untag_ptr(e);
24782         CHECK_ACCESS(e_ptr);
24783         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24784         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24785         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24786         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
24787         return tag_ptr(ret_conv, true);
24788 }
24789
24790 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
24791         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
24792         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
24793         return ret_conv;
24794 }
24795
24796 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
24797         if (!ptr_is_owned(_res)) return;
24798         void* _res_ptr = untag_ptr(_res);
24799         CHECK_ACCESS(_res_ptr);
24800         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
24801         FREE(untag_ptr(_res));
24802         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
24803 }
24804
24805 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
24806         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24807         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
24808         return tag_ptr(ret_conv, true);
24809 }
24810 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
24811         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
24812         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
24813         return ret_conv;
24814 }
24815
24816 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
24817         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
24818         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24819         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
24820         return tag_ptr(ret_conv, true);
24821 }
24822
24823 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
24824         LDKCommitmentSigned o_conv;
24825         o_conv.inner = untag_ptr(o);
24826         o_conv.is_owned = ptr_is_owned(o);
24827         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24828         o_conv = CommitmentSigned_clone(&o_conv);
24829         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24830         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
24831         return tag_ptr(ret_conv, true);
24832 }
24833
24834 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
24835         void* e_ptr = untag_ptr(e);
24836         CHECK_ACCESS(e_ptr);
24837         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24838         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24839         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24840         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
24841         return tag_ptr(ret_conv, true);
24842 }
24843
24844 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
24845         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
24846         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
24847         return ret_conv;
24848 }
24849
24850 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
24851         if (!ptr_is_owned(_res)) return;
24852         void* _res_ptr = untag_ptr(_res);
24853         CHECK_ACCESS(_res_ptr);
24854         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
24855         FREE(untag_ptr(_res));
24856         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
24857 }
24858
24859 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
24860         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24861         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
24862         return tag_ptr(ret_conv, true);
24863 }
24864 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24865         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
24866         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
24867         return ret_conv;
24868 }
24869
24870 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
24871         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
24872         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24873         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
24874         return tag_ptr(ret_conv, true);
24875 }
24876
24877 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
24878         LDKFundingCreated o_conv;
24879         o_conv.inner = untag_ptr(o);
24880         o_conv.is_owned = ptr_is_owned(o);
24881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24882         o_conv = FundingCreated_clone(&o_conv);
24883         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24884         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
24885         return tag_ptr(ret_conv, true);
24886 }
24887
24888 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
24889         void* e_ptr = untag_ptr(e);
24890         CHECK_ACCESS(e_ptr);
24891         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24892         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24893         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24894         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
24895         return tag_ptr(ret_conv, true);
24896 }
24897
24898 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
24899         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
24900         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
24901         return ret_conv;
24902 }
24903
24904 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
24905         if (!ptr_is_owned(_res)) return;
24906         void* _res_ptr = untag_ptr(_res);
24907         CHECK_ACCESS(_res_ptr);
24908         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
24909         FREE(untag_ptr(_res));
24910         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
24911 }
24912
24913 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
24914         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24915         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
24916         return tag_ptr(ret_conv, true);
24917 }
24918 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
24919         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
24920         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
24921         return ret_conv;
24922 }
24923
24924 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
24925         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
24926         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24927         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
24928         return tag_ptr(ret_conv, true);
24929 }
24930
24931 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
24932         LDKFundingSigned o_conv;
24933         o_conv.inner = untag_ptr(o);
24934         o_conv.is_owned = ptr_is_owned(o);
24935         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24936         o_conv = FundingSigned_clone(&o_conv);
24937         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24938         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
24939         return tag_ptr(ret_conv, true);
24940 }
24941
24942 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
24943         void* e_ptr = untag_ptr(e);
24944         CHECK_ACCESS(e_ptr);
24945         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24946         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24947         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24948         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
24949         return tag_ptr(ret_conv, true);
24950 }
24951
24952 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
24953         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
24954         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
24955         return ret_conv;
24956 }
24957
24958 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
24959         if (!ptr_is_owned(_res)) return;
24960         void* _res_ptr = untag_ptr(_res);
24961         CHECK_ACCESS(_res_ptr);
24962         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
24963         FREE(untag_ptr(_res));
24964         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
24965 }
24966
24967 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
24968         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24969         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
24970         return tag_ptr(ret_conv, true);
24971 }
24972 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24973         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
24974         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
24975         return ret_conv;
24976 }
24977
24978 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
24979         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
24980         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24981         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
24982         return tag_ptr(ret_conv, true);
24983 }
24984
24985 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
24986         LDKChannelReady o_conv;
24987         o_conv.inner = untag_ptr(o);
24988         o_conv.is_owned = ptr_is_owned(o);
24989         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24990         o_conv = ChannelReady_clone(&o_conv);
24991         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24992         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
24993         return tag_ptr(ret_conv, true);
24994 }
24995
24996 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
24997         void* e_ptr = untag_ptr(e);
24998         CHECK_ACCESS(e_ptr);
24999         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25000         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25001         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
25002         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
25003         return tag_ptr(ret_conv, true);
25004 }
25005
25006 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
25007         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
25008         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
25009         return ret_conv;
25010 }
25011
25012 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
25013         if (!ptr_is_owned(_res)) return;
25014         void* _res_ptr = untag_ptr(_res);
25015         CHECK_ACCESS(_res_ptr);
25016         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
25017         FREE(untag_ptr(_res));
25018         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
25019 }
25020
25021 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
25022         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
25023         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
25024         return tag_ptr(ret_conv, true);
25025 }
25026 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
25027         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
25028         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
25029         return ret_conv;
25030 }
25031
25032 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
25033         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
25034         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
25035         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
25036         return tag_ptr(ret_conv, true);
25037 }
25038
25039 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
25040         LDKInit o_conv;
25041         o_conv.inner = untag_ptr(o);
25042         o_conv.is_owned = ptr_is_owned(o);
25043         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25044         o_conv = Init_clone(&o_conv);
25045         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
25046         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
25047         return tag_ptr(ret_conv, true);
25048 }
25049
25050 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
25051         void* e_ptr = untag_ptr(e);
25052         CHECK_ACCESS(e_ptr);
25053         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25054         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25055         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
25056         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
25057         return tag_ptr(ret_conv, true);
25058 }
25059
25060 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
25061         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
25062         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
25063         return ret_conv;
25064 }
25065
25066 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
25067         if (!ptr_is_owned(_res)) return;
25068         void* _res_ptr = untag_ptr(_res);
25069         CHECK_ACCESS(_res_ptr);
25070         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
25071         FREE(untag_ptr(_res));
25072         CResult_InitDecodeErrorZ_free(_res_conv);
25073 }
25074
25075 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
25076         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
25077         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
25078         return tag_ptr(ret_conv, true);
25079 }
25080 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
25081         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
25082         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
25083         return ret_conv;
25084 }
25085
25086 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
25087         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
25088         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
25089         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
25090         return tag_ptr(ret_conv, true);
25091 }
25092
25093 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
25094         LDKOpenChannel o_conv;
25095         o_conv.inner = untag_ptr(o);
25096         o_conv.is_owned = ptr_is_owned(o);
25097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25098         o_conv = OpenChannel_clone(&o_conv);
25099         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
25100         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
25101         return tag_ptr(ret_conv, true);
25102 }
25103
25104 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
25105         void* e_ptr = untag_ptr(e);
25106         CHECK_ACCESS(e_ptr);
25107         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25108         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25109         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
25110         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
25111         return tag_ptr(ret_conv, true);
25112 }
25113
25114 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
25115         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
25116         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
25117         return ret_conv;
25118 }
25119
25120 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
25121         if (!ptr_is_owned(_res)) return;
25122         void* _res_ptr = untag_ptr(_res);
25123         CHECK_ACCESS(_res_ptr);
25124         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
25125         FREE(untag_ptr(_res));
25126         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
25127 }
25128
25129 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
25130         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
25131         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
25132         return tag_ptr(ret_conv, true);
25133 }
25134 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
25135         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
25136         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
25137         return ret_conv;
25138 }
25139
25140 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
25141         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
25142         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
25143         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
25144         return tag_ptr(ret_conv, true);
25145 }
25146
25147 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
25148         LDKOpenChannelV2 o_conv;
25149         o_conv.inner = untag_ptr(o);
25150         o_conv.is_owned = ptr_is_owned(o);
25151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25152         o_conv = OpenChannelV2_clone(&o_conv);
25153         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
25154         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
25155         return tag_ptr(ret_conv, true);
25156 }
25157
25158 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
25159         void* e_ptr = untag_ptr(e);
25160         CHECK_ACCESS(e_ptr);
25161         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25162         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25163         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
25164         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
25165         return tag_ptr(ret_conv, true);
25166 }
25167
25168 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
25169         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
25170         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
25171         return ret_conv;
25172 }
25173
25174 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
25175         if (!ptr_is_owned(_res)) return;
25176         void* _res_ptr = untag_ptr(_res);
25177         CHECK_ACCESS(_res_ptr);
25178         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
25179         FREE(untag_ptr(_res));
25180         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
25181 }
25182
25183 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
25184         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
25185         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
25186         return tag_ptr(ret_conv, true);
25187 }
25188 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
25189         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
25190         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
25191         return ret_conv;
25192 }
25193
25194 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
25195         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
25196         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
25197         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
25198         return tag_ptr(ret_conv, true);
25199 }
25200
25201 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
25202         LDKRevokeAndACK o_conv;
25203         o_conv.inner = untag_ptr(o);
25204         o_conv.is_owned = ptr_is_owned(o);
25205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25206         o_conv = RevokeAndACK_clone(&o_conv);
25207         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
25208         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
25209         return tag_ptr(ret_conv, true);
25210 }
25211
25212 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
25213         void* e_ptr = untag_ptr(e);
25214         CHECK_ACCESS(e_ptr);
25215         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25216         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25217         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
25218         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
25219         return tag_ptr(ret_conv, true);
25220 }
25221
25222 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
25223         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
25224         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
25225         return ret_conv;
25226 }
25227
25228 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
25229         if (!ptr_is_owned(_res)) return;
25230         void* _res_ptr = untag_ptr(_res);
25231         CHECK_ACCESS(_res_ptr);
25232         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
25233         FREE(untag_ptr(_res));
25234         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
25235 }
25236
25237 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
25238         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
25239         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
25240         return tag_ptr(ret_conv, true);
25241 }
25242 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
25243         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
25244         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
25245         return ret_conv;
25246 }
25247
25248 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
25249         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
25250         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
25251         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
25252         return tag_ptr(ret_conv, true);
25253 }
25254
25255 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
25256         LDKShutdown o_conv;
25257         o_conv.inner = untag_ptr(o);
25258         o_conv.is_owned = ptr_is_owned(o);
25259         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25260         o_conv = Shutdown_clone(&o_conv);
25261         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
25262         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
25263         return tag_ptr(ret_conv, true);
25264 }
25265
25266 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
25267         void* e_ptr = untag_ptr(e);
25268         CHECK_ACCESS(e_ptr);
25269         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25270         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25271         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
25272         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
25273         return tag_ptr(ret_conv, true);
25274 }
25275
25276 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
25277         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
25278         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
25279         return ret_conv;
25280 }
25281
25282 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
25283         if (!ptr_is_owned(_res)) return;
25284         void* _res_ptr = untag_ptr(_res);
25285         CHECK_ACCESS(_res_ptr);
25286         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
25287         FREE(untag_ptr(_res));
25288         CResult_ShutdownDecodeErrorZ_free(_res_conv);
25289 }
25290
25291 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
25292         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
25293         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
25294         return tag_ptr(ret_conv, true);
25295 }
25296 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
25297         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
25298         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
25299         return ret_conv;
25300 }
25301
25302 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
25303         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
25304         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
25305         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
25306         return tag_ptr(ret_conv, true);
25307 }
25308
25309 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
25310         LDKUpdateFailHTLC o_conv;
25311         o_conv.inner = untag_ptr(o);
25312         o_conv.is_owned = ptr_is_owned(o);
25313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25314         o_conv = UpdateFailHTLC_clone(&o_conv);
25315         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
25316         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
25317         return tag_ptr(ret_conv, true);
25318 }
25319
25320 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
25321         void* e_ptr = untag_ptr(e);
25322         CHECK_ACCESS(e_ptr);
25323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25325         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
25326         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
25327         return tag_ptr(ret_conv, true);
25328 }
25329
25330 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
25331         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
25332         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
25333         return ret_conv;
25334 }
25335
25336 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
25337         if (!ptr_is_owned(_res)) return;
25338         void* _res_ptr = untag_ptr(_res);
25339         CHECK_ACCESS(_res_ptr);
25340         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
25341         FREE(untag_ptr(_res));
25342         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
25343 }
25344
25345 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
25346         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
25347         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
25348         return tag_ptr(ret_conv, true);
25349 }
25350 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25351         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
25352         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
25353         return ret_conv;
25354 }
25355
25356 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
25357         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
25358         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
25359         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
25360         return tag_ptr(ret_conv, true);
25361 }
25362
25363 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
25364         LDKUpdateFailMalformedHTLC o_conv;
25365         o_conv.inner = untag_ptr(o);
25366         o_conv.is_owned = ptr_is_owned(o);
25367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25368         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
25369         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25370         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
25371         return tag_ptr(ret_conv, true);
25372 }
25373
25374 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
25375         void* e_ptr = untag_ptr(e);
25376         CHECK_ACCESS(e_ptr);
25377         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25378         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25379         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25380         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
25381         return tag_ptr(ret_conv, true);
25382 }
25383
25384 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
25385         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
25386         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
25387         return ret_conv;
25388 }
25389
25390 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
25391         if (!ptr_is_owned(_res)) return;
25392         void* _res_ptr = untag_ptr(_res);
25393         CHECK_ACCESS(_res_ptr);
25394         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
25395         FREE(untag_ptr(_res));
25396         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
25397 }
25398
25399 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
25400         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25401         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
25402         return tag_ptr(ret_conv, true);
25403 }
25404 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25405         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
25406         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
25407         return ret_conv;
25408 }
25409
25410 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
25411         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
25412         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25413         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
25414         return tag_ptr(ret_conv, true);
25415 }
25416
25417 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
25418         LDKUpdateFee o_conv;
25419         o_conv.inner = untag_ptr(o);
25420         o_conv.is_owned = ptr_is_owned(o);
25421         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25422         o_conv = UpdateFee_clone(&o_conv);
25423         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25424         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
25425         return tag_ptr(ret_conv, true);
25426 }
25427
25428 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
25429         void* e_ptr = untag_ptr(e);
25430         CHECK_ACCESS(e_ptr);
25431         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25432         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25433         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25434         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
25435         return tag_ptr(ret_conv, true);
25436 }
25437
25438 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
25439         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
25440         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
25441         return ret_conv;
25442 }
25443
25444 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
25445         if (!ptr_is_owned(_res)) return;
25446         void* _res_ptr = untag_ptr(_res);
25447         CHECK_ACCESS(_res_ptr);
25448         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
25449         FREE(untag_ptr(_res));
25450         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
25451 }
25452
25453 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
25454         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25455         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
25456         return tag_ptr(ret_conv, true);
25457 }
25458 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
25459         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
25460         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
25461         return ret_conv;
25462 }
25463
25464 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
25465         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
25466         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25467         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
25468         return tag_ptr(ret_conv, true);
25469 }
25470
25471 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
25472         LDKUpdateFulfillHTLC o_conv;
25473         o_conv.inner = untag_ptr(o);
25474         o_conv.is_owned = ptr_is_owned(o);
25475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25476         o_conv = UpdateFulfillHTLC_clone(&o_conv);
25477         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25478         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
25479         return tag_ptr(ret_conv, true);
25480 }
25481
25482 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
25483         void* e_ptr = untag_ptr(e);
25484         CHECK_ACCESS(e_ptr);
25485         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25486         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25487         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25488         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
25489         return tag_ptr(ret_conv, true);
25490 }
25491
25492 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
25493         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
25494         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
25495         return ret_conv;
25496 }
25497
25498 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
25499         if (!ptr_is_owned(_res)) return;
25500         void* _res_ptr = untag_ptr(_res);
25501         CHECK_ACCESS(_res_ptr);
25502         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
25503         FREE(untag_ptr(_res));
25504         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
25505 }
25506
25507 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
25508         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25509         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
25510         return tag_ptr(ret_conv, true);
25511 }
25512 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25513         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
25514         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
25515         return ret_conv;
25516 }
25517
25518 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
25519         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
25520         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25521         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
25522         return tag_ptr(ret_conv, true);
25523 }
25524
25525 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
25526         LDKUpdateAddHTLC o_conv;
25527         o_conv.inner = untag_ptr(o);
25528         o_conv.is_owned = ptr_is_owned(o);
25529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25530         o_conv = UpdateAddHTLC_clone(&o_conv);
25531         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25532         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
25533         return tag_ptr(ret_conv, true);
25534 }
25535
25536 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
25537         void* e_ptr = untag_ptr(e);
25538         CHECK_ACCESS(e_ptr);
25539         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25540         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25541         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25542         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
25543         return tag_ptr(ret_conv, true);
25544 }
25545
25546 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
25547         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
25548         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
25549         return ret_conv;
25550 }
25551
25552 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
25553         if (!ptr_is_owned(_res)) return;
25554         void* _res_ptr = untag_ptr(_res);
25555         CHECK_ACCESS(_res_ptr);
25556         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
25557         FREE(untag_ptr(_res));
25558         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
25559 }
25560
25561 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
25562         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25563         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
25564         return tag_ptr(ret_conv, true);
25565 }
25566 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25567         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
25568         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
25569         return ret_conv;
25570 }
25571
25572 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
25573         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
25574         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25575         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
25576         return tag_ptr(ret_conv, true);
25577 }
25578
25579 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
25580         LDKOnionMessage o_conv;
25581         o_conv.inner = untag_ptr(o);
25582         o_conv.is_owned = ptr_is_owned(o);
25583         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25584         o_conv = OnionMessage_clone(&o_conv);
25585         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25586         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
25587         return tag_ptr(ret_conv, true);
25588 }
25589
25590 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
25591         void* e_ptr = untag_ptr(e);
25592         CHECK_ACCESS(e_ptr);
25593         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25594         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25595         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25596         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
25597         return tag_ptr(ret_conv, true);
25598 }
25599
25600 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
25601         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
25602         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
25603         return ret_conv;
25604 }
25605
25606 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
25607         if (!ptr_is_owned(_res)) return;
25608         void* _res_ptr = untag_ptr(_res);
25609         CHECK_ACCESS(_res_ptr);
25610         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
25611         FREE(untag_ptr(_res));
25612         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
25613 }
25614
25615 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
25616         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25617         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
25618         return tag_ptr(ret_conv, true);
25619 }
25620 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25621         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
25622         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
25623         return ret_conv;
25624 }
25625
25626 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
25627         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
25628         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25629         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
25630         return tag_ptr(ret_conv, true);
25631 }
25632
25633 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
25634         LDKPing o_conv;
25635         o_conv.inner = untag_ptr(o);
25636         o_conv.is_owned = ptr_is_owned(o);
25637         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25638         o_conv = Ping_clone(&o_conv);
25639         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25640         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
25641         return tag_ptr(ret_conv, true);
25642 }
25643
25644 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
25645         void* e_ptr = untag_ptr(e);
25646         CHECK_ACCESS(e_ptr);
25647         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25648         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25649         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25650         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
25651         return tag_ptr(ret_conv, true);
25652 }
25653
25654 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
25655         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
25656         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
25657         return ret_conv;
25658 }
25659
25660 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
25661         if (!ptr_is_owned(_res)) return;
25662         void* _res_ptr = untag_ptr(_res);
25663         CHECK_ACCESS(_res_ptr);
25664         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
25665         FREE(untag_ptr(_res));
25666         CResult_PingDecodeErrorZ_free(_res_conv);
25667 }
25668
25669 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
25670         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25671         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
25672         return tag_ptr(ret_conv, true);
25673 }
25674 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
25675         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
25676         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
25677         return ret_conv;
25678 }
25679
25680 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
25681         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
25682         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25683         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
25684         return tag_ptr(ret_conv, true);
25685 }
25686
25687 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
25688         LDKPong o_conv;
25689         o_conv.inner = untag_ptr(o);
25690         o_conv.is_owned = ptr_is_owned(o);
25691         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25692         o_conv = Pong_clone(&o_conv);
25693         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25694         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
25695         return tag_ptr(ret_conv, true);
25696 }
25697
25698 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
25699         void* e_ptr = untag_ptr(e);
25700         CHECK_ACCESS(e_ptr);
25701         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25702         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25703         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25704         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
25705         return tag_ptr(ret_conv, true);
25706 }
25707
25708 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
25709         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
25710         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
25711         return ret_conv;
25712 }
25713
25714 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
25715         if (!ptr_is_owned(_res)) return;
25716         void* _res_ptr = untag_ptr(_res);
25717         CHECK_ACCESS(_res_ptr);
25718         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
25719         FREE(untag_ptr(_res));
25720         CResult_PongDecodeErrorZ_free(_res_conv);
25721 }
25722
25723 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
25724         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25725         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
25726         return tag_ptr(ret_conv, true);
25727 }
25728 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
25729         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
25730         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
25731         return ret_conv;
25732 }
25733
25734 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
25735         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
25736         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25737         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
25738         return tag_ptr(ret_conv, true);
25739 }
25740
25741 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
25742         LDKUnsignedChannelAnnouncement o_conv;
25743         o_conv.inner = untag_ptr(o);
25744         o_conv.is_owned = ptr_is_owned(o);
25745         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25746         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
25747         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25748         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
25749         return tag_ptr(ret_conv, true);
25750 }
25751
25752 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
25753         void* e_ptr = untag_ptr(e);
25754         CHECK_ACCESS(e_ptr);
25755         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25756         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25757         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25758         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
25759         return tag_ptr(ret_conv, true);
25760 }
25761
25762 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25763         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25764         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25765         return ret_conv;
25766 }
25767
25768 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
25769         if (!ptr_is_owned(_res)) return;
25770         void* _res_ptr = untag_ptr(_res);
25771         CHECK_ACCESS(_res_ptr);
25772         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25773         FREE(untag_ptr(_res));
25774         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
25775 }
25776
25777 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25778         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25779         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
25780         return tag_ptr(ret_conv, true);
25781 }
25782 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25783         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25784         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25785         return ret_conv;
25786 }
25787
25788 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25789         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25790         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25791         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25792         return tag_ptr(ret_conv, true);
25793 }
25794
25795 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
25796         LDKChannelAnnouncement o_conv;
25797         o_conv.inner = untag_ptr(o);
25798         o_conv.is_owned = ptr_is_owned(o);
25799         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25800         o_conv = ChannelAnnouncement_clone(&o_conv);
25801         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25802         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
25803         return tag_ptr(ret_conv, true);
25804 }
25805
25806 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
25807         void* e_ptr = untag_ptr(e);
25808         CHECK_ACCESS(e_ptr);
25809         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25810         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25811         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25812         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
25813         return tag_ptr(ret_conv, true);
25814 }
25815
25816 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25817         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25818         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25819         return ret_conv;
25820 }
25821
25822 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
25823         if (!ptr_is_owned(_res)) return;
25824         void* _res_ptr = untag_ptr(_res);
25825         CHECK_ACCESS(_res_ptr);
25826         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25827         FREE(untag_ptr(_res));
25828         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
25829 }
25830
25831 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25832         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25833         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
25834         return tag_ptr(ret_conv, true);
25835 }
25836 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25837         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25838         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25839         return ret_conv;
25840 }
25841
25842 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25843         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25844         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25845         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25846         return tag_ptr(ret_conv, true);
25847 }
25848
25849 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25850         LDKUnsignedChannelUpdate o_conv;
25851         o_conv.inner = untag_ptr(o);
25852         o_conv.is_owned = ptr_is_owned(o);
25853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25854         o_conv = UnsignedChannelUpdate_clone(&o_conv);
25855         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25856         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
25857         return tag_ptr(ret_conv, true);
25858 }
25859
25860 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
25861         void* e_ptr = untag_ptr(e);
25862         CHECK_ACCESS(e_ptr);
25863         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25864         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25865         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25866         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
25867         return tag_ptr(ret_conv, true);
25868 }
25869
25870 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25871         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
25872         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
25873         return ret_conv;
25874 }
25875
25876 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25877         if (!ptr_is_owned(_res)) return;
25878         void* _res_ptr = untag_ptr(_res);
25879         CHECK_ACCESS(_res_ptr);
25880         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
25881         FREE(untag_ptr(_res));
25882         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
25883 }
25884
25885 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25886         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25887         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
25888         return tag_ptr(ret_conv, true);
25889 }
25890 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25891         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25892         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25893         return ret_conv;
25894 }
25895
25896 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25897         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25898         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25899         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
25900         return tag_ptr(ret_conv, true);
25901 }
25902
25903 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25904         LDKChannelUpdate o_conv;
25905         o_conv.inner = untag_ptr(o);
25906         o_conv.is_owned = ptr_is_owned(o);
25907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25908         o_conv = ChannelUpdate_clone(&o_conv);
25909         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25910         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
25911         return tag_ptr(ret_conv, true);
25912 }
25913
25914 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
25915         void* e_ptr = untag_ptr(e);
25916         CHECK_ACCESS(e_ptr);
25917         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25918         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25919         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25920         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
25921         return tag_ptr(ret_conv, true);
25922 }
25923
25924 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25925         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
25926         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
25927         return ret_conv;
25928 }
25929
25930 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25931         if (!ptr_is_owned(_res)) return;
25932         void* _res_ptr = untag_ptr(_res);
25933         CHECK_ACCESS(_res_ptr);
25934         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
25935         FREE(untag_ptr(_res));
25936         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
25937 }
25938
25939 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25940         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25941         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
25942         return tag_ptr(ret_conv, true);
25943 }
25944 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25945         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25946         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25947         return ret_conv;
25948 }
25949
25950 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25951         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25952         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25953         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
25954         return tag_ptr(ret_conv, true);
25955 }
25956
25957 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
25958         LDKErrorMessage o_conv;
25959         o_conv.inner = untag_ptr(o);
25960         o_conv.is_owned = ptr_is_owned(o);
25961         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25962         o_conv = ErrorMessage_clone(&o_conv);
25963         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25964         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
25965         return tag_ptr(ret_conv, true);
25966 }
25967
25968 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
25969         void* e_ptr = untag_ptr(e);
25970         CHECK_ACCESS(e_ptr);
25971         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25972         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25973         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25974         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
25975         return tag_ptr(ret_conv, true);
25976 }
25977
25978 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
25979         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
25980         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
25981         return ret_conv;
25982 }
25983
25984 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
25985         if (!ptr_is_owned(_res)) return;
25986         void* _res_ptr = untag_ptr(_res);
25987         CHECK_ACCESS(_res_ptr);
25988         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
25989         FREE(untag_ptr(_res));
25990         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
25991 }
25992
25993 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
25994         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25995         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
25996         return tag_ptr(ret_conv, true);
25997 }
25998 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25999         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
26000         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
26001         return ret_conv;
26002 }
26003
26004 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
26005         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
26006         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
26007         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
26008         return tag_ptr(ret_conv, true);
26009 }
26010
26011 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
26012         LDKWarningMessage o_conv;
26013         o_conv.inner = untag_ptr(o);
26014         o_conv.is_owned = ptr_is_owned(o);
26015         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26016         o_conv = WarningMessage_clone(&o_conv);
26017         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
26018         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
26019         return tag_ptr(ret_conv, true);
26020 }
26021
26022 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
26023         void* e_ptr = untag_ptr(e);
26024         CHECK_ACCESS(e_ptr);
26025         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26026         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26027         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
26028         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
26029         return tag_ptr(ret_conv, true);
26030 }
26031
26032 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
26033         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
26034         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
26035         return ret_conv;
26036 }
26037
26038 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
26039         if (!ptr_is_owned(_res)) return;
26040         void* _res_ptr = untag_ptr(_res);
26041         CHECK_ACCESS(_res_ptr);
26042         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
26043         FREE(untag_ptr(_res));
26044         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
26045 }
26046
26047 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
26048         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
26049         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
26050         return tag_ptr(ret_conv, true);
26051 }
26052 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
26053         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
26054         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
26055         return ret_conv;
26056 }
26057
26058 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
26059         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
26060         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
26061         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
26062         return tag_ptr(ret_conv, true);
26063 }
26064
26065 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
26066         LDKUnsignedNodeAnnouncement o_conv;
26067         o_conv.inner = untag_ptr(o);
26068         o_conv.is_owned = ptr_is_owned(o);
26069         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26070         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
26071         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26072         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
26073         return tag_ptr(ret_conv, true);
26074 }
26075
26076 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
26077         void* e_ptr = untag_ptr(e);
26078         CHECK_ACCESS(e_ptr);
26079         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26080         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26081         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26082         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
26083         return tag_ptr(ret_conv, true);
26084 }
26085
26086 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
26087         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
26088         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
26089         return ret_conv;
26090 }
26091
26092 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
26093         if (!ptr_is_owned(_res)) return;
26094         void* _res_ptr = untag_ptr(_res);
26095         CHECK_ACCESS(_res_ptr);
26096         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
26097         FREE(untag_ptr(_res));
26098         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
26099 }
26100
26101 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
26102         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26103         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
26104         return tag_ptr(ret_conv, true);
26105 }
26106 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
26107         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
26108         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
26109         return ret_conv;
26110 }
26111
26112 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
26113         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
26114         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26115         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
26116         return tag_ptr(ret_conv, true);
26117 }
26118
26119 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
26120         LDKNodeAnnouncement o_conv;
26121         o_conv.inner = untag_ptr(o);
26122         o_conv.is_owned = ptr_is_owned(o);
26123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26124         o_conv = NodeAnnouncement_clone(&o_conv);
26125         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26126         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
26127         return tag_ptr(ret_conv, true);
26128 }
26129
26130 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
26131         void* e_ptr = untag_ptr(e);
26132         CHECK_ACCESS(e_ptr);
26133         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26134         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26135         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26136         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
26137         return tag_ptr(ret_conv, true);
26138 }
26139
26140 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
26141         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
26142         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
26143         return ret_conv;
26144 }
26145
26146 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
26147         if (!ptr_is_owned(_res)) return;
26148         void* _res_ptr = untag_ptr(_res);
26149         CHECK_ACCESS(_res_ptr);
26150         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
26151         FREE(untag_ptr(_res));
26152         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
26153 }
26154
26155 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
26156         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26157         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
26158         return tag_ptr(ret_conv, true);
26159 }
26160 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
26161         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
26162         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
26163         return ret_conv;
26164 }
26165
26166 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
26167         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
26168         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26169         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
26170         return tag_ptr(ret_conv, true);
26171 }
26172
26173 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
26174         LDKQueryShortChannelIds o_conv;
26175         o_conv.inner = untag_ptr(o);
26176         o_conv.is_owned = ptr_is_owned(o);
26177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26178         o_conv = QueryShortChannelIds_clone(&o_conv);
26179         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26180         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
26181         return tag_ptr(ret_conv, true);
26182 }
26183
26184 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
26185         void* e_ptr = untag_ptr(e);
26186         CHECK_ACCESS(e_ptr);
26187         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26188         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26189         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26190         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
26191         return tag_ptr(ret_conv, true);
26192 }
26193
26194 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
26195         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
26196         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
26197         return ret_conv;
26198 }
26199
26200 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
26201         if (!ptr_is_owned(_res)) return;
26202         void* _res_ptr = untag_ptr(_res);
26203         CHECK_ACCESS(_res_ptr);
26204         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
26205         FREE(untag_ptr(_res));
26206         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
26207 }
26208
26209 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
26210         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26211         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
26212         return tag_ptr(ret_conv, true);
26213 }
26214 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
26215         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
26216         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
26217         return ret_conv;
26218 }
26219
26220 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
26221         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
26222         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26223         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
26224         return tag_ptr(ret_conv, true);
26225 }
26226
26227 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
26228         LDKReplyShortChannelIdsEnd o_conv;
26229         o_conv.inner = untag_ptr(o);
26230         o_conv.is_owned = ptr_is_owned(o);
26231         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26232         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
26233         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26234         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
26235         return tag_ptr(ret_conv, true);
26236 }
26237
26238 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
26239         void* e_ptr = untag_ptr(e);
26240         CHECK_ACCESS(e_ptr);
26241         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26242         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26243         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26244         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
26245         return tag_ptr(ret_conv, true);
26246 }
26247
26248 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
26249         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
26250         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
26251         return ret_conv;
26252 }
26253
26254 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
26255         if (!ptr_is_owned(_res)) return;
26256         void* _res_ptr = untag_ptr(_res);
26257         CHECK_ACCESS(_res_ptr);
26258         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
26259         FREE(untag_ptr(_res));
26260         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
26261 }
26262
26263 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
26264         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26265         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
26266         return tag_ptr(ret_conv, true);
26267 }
26268 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
26269         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
26270         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
26271         return ret_conv;
26272 }
26273
26274 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
26275         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
26276         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26277         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
26278         return tag_ptr(ret_conv, true);
26279 }
26280
26281 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
26282         LDKQueryChannelRange o_conv;
26283         o_conv.inner = untag_ptr(o);
26284         o_conv.is_owned = ptr_is_owned(o);
26285         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26286         o_conv = QueryChannelRange_clone(&o_conv);
26287         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26288         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
26289         return tag_ptr(ret_conv, true);
26290 }
26291
26292 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
26293         void* e_ptr = untag_ptr(e);
26294         CHECK_ACCESS(e_ptr);
26295         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26296         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26297         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26298         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
26299         return tag_ptr(ret_conv, true);
26300 }
26301
26302 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
26303         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
26304         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
26305         return ret_conv;
26306 }
26307
26308 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
26309         if (!ptr_is_owned(_res)) return;
26310         void* _res_ptr = untag_ptr(_res);
26311         CHECK_ACCESS(_res_ptr);
26312         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
26313         FREE(untag_ptr(_res));
26314         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
26315 }
26316
26317 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
26318         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26319         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
26320         return tag_ptr(ret_conv, true);
26321 }
26322 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
26323         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
26324         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
26325         return ret_conv;
26326 }
26327
26328 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
26329         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
26330         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26331         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
26332         return tag_ptr(ret_conv, true);
26333 }
26334
26335 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
26336         LDKReplyChannelRange o_conv;
26337         o_conv.inner = untag_ptr(o);
26338         o_conv.is_owned = ptr_is_owned(o);
26339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26340         o_conv = ReplyChannelRange_clone(&o_conv);
26341         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26342         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
26343         return tag_ptr(ret_conv, true);
26344 }
26345
26346 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
26347         void* e_ptr = untag_ptr(e);
26348         CHECK_ACCESS(e_ptr);
26349         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26350         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26351         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26352         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
26353         return tag_ptr(ret_conv, true);
26354 }
26355
26356 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
26357         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
26358         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
26359         return ret_conv;
26360 }
26361
26362 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
26363         if (!ptr_is_owned(_res)) return;
26364         void* _res_ptr = untag_ptr(_res);
26365         CHECK_ACCESS(_res_ptr);
26366         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
26367         FREE(untag_ptr(_res));
26368         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
26369 }
26370
26371 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
26372         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26373         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
26374         return tag_ptr(ret_conv, true);
26375 }
26376 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
26377         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
26378         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
26379         return ret_conv;
26380 }
26381
26382 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
26383         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
26384         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26385         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
26386         return tag_ptr(ret_conv, true);
26387 }
26388
26389 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
26390         LDKGossipTimestampFilter o_conv;
26391         o_conv.inner = untag_ptr(o);
26392         o_conv.is_owned = ptr_is_owned(o);
26393         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26394         o_conv = GossipTimestampFilter_clone(&o_conv);
26395         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26396         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
26397         return tag_ptr(ret_conv, true);
26398 }
26399
26400 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
26401         void* e_ptr = untag_ptr(e);
26402         CHECK_ACCESS(e_ptr);
26403         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26404         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26405         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26406         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
26407         return tag_ptr(ret_conv, true);
26408 }
26409
26410 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
26411         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
26412         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
26413         return ret_conv;
26414 }
26415
26416 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
26417         if (!ptr_is_owned(_res)) return;
26418         void* _res_ptr = untag_ptr(_res);
26419         CHECK_ACCESS(_res_ptr);
26420         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
26421         FREE(untag_ptr(_res));
26422         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
26423 }
26424
26425 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
26426         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26427         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
26428         return tag_ptr(ret_conv, true);
26429 }
26430 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
26431         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
26432         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
26433         return ret_conv;
26434 }
26435
26436 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
26437         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
26438         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26439         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
26440         return tag_ptr(ret_conv, true);
26441 }
26442
26443 uint64_t  __attribute__((export_name("TS_COption_KeyPairZ_some"))) TS_COption_KeyPairZ_some(int8_tArray o) {
26444         LDKSecretKey o_ref;
26445         CHECK(o->arr_len == 32);
26446         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
26447         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26448         *ret_copy = COption_KeyPairZ_some(o_ref);
26449         uint64_t ret_ref = tag_ptr(ret_copy, true);
26450         return ret_ref;
26451 }
26452
26453 uint64_t  __attribute__((export_name("TS_COption_KeyPairZ_none"))) TS_COption_KeyPairZ_none() {
26454         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26455         *ret_copy = COption_KeyPairZ_none();
26456         uint64_t ret_ref = tag_ptr(ret_copy, true);
26457         return ret_ref;
26458 }
26459
26460 void  __attribute__((export_name("TS_COption_KeyPairZ_free"))) TS_COption_KeyPairZ_free(uint64_t _res) {
26461         if (!ptr_is_owned(_res)) return;
26462         void* _res_ptr = untag_ptr(_res);
26463         CHECK_ACCESS(_res_ptr);
26464         LDKCOption_KeyPairZ _res_conv = *(LDKCOption_KeyPairZ*)(_res_ptr);
26465         FREE(untag_ptr(_res));
26466         COption_KeyPairZ_free(_res_conv);
26467 }
26468
26469 static inline uint64_t COption_KeyPairZ_clone_ptr(LDKCOption_KeyPairZ *NONNULL_PTR arg) {
26470         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26471         *ret_copy = COption_KeyPairZ_clone(arg);
26472         uint64_t ret_ref = tag_ptr(ret_copy, true);
26473         return ret_ref;
26474 }
26475 int64_t  __attribute__((export_name("TS_COption_KeyPairZ_clone_ptr"))) TS_COption_KeyPairZ_clone_ptr(uint64_t arg) {
26476         LDKCOption_KeyPairZ* arg_conv = (LDKCOption_KeyPairZ*)untag_ptr(arg);
26477         int64_t ret_conv = COption_KeyPairZ_clone_ptr(arg_conv);
26478         return ret_conv;
26479 }
26480
26481 uint64_t  __attribute__((export_name("TS_COption_KeyPairZ_clone"))) TS_COption_KeyPairZ_clone(uint64_t orig) {
26482         LDKCOption_KeyPairZ* orig_conv = (LDKCOption_KeyPairZ*)untag_ptr(orig);
26483         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26484         *ret_copy = COption_KeyPairZ_clone(orig_conv);
26485         uint64_t ret_ref = tag_ptr(ret_copy, true);
26486         return ret_ref;
26487 }
26488
26489 uint64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_ok"))) TS_CResult_COption_KeyPairZNoneZ_ok(uint64_t o) {
26490         void* o_ptr = untag_ptr(o);
26491         CHECK_ACCESS(o_ptr);
26492         LDKCOption_KeyPairZ o_conv = *(LDKCOption_KeyPairZ*)(o_ptr);
26493         o_conv = COption_KeyPairZ_clone((LDKCOption_KeyPairZ*)untag_ptr(o));
26494         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26495         *ret_conv = CResult_COption_KeyPairZNoneZ_ok(o_conv);
26496         return tag_ptr(ret_conv, true);
26497 }
26498
26499 uint64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_err"))) TS_CResult_COption_KeyPairZNoneZ_err() {
26500         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26501         *ret_conv = CResult_COption_KeyPairZNoneZ_err();
26502         return tag_ptr(ret_conv, true);
26503 }
26504
26505 jboolean  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_is_ok"))) TS_CResult_COption_KeyPairZNoneZ_is_ok(uint64_t o) {
26506         LDKCResult_COption_KeyPairZNoneZ* o_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(o);
26507         jboolean ret_conv = CResult_COption_KeyPairZNoneZ_is_ok(o_conv);
26508         return ret_conv;
26509 }
26510
26511 void  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_free"))) TS_CResult_COption_KeyPairZNoneZ_free(uint64_t _res) {
26512         if (!ptr_is_owned(_res)) return;
26513         void* _res_ptr = untag_ptr(_res);
26514         CHECK_ACCESS(_res_ptr);
26515         LDKCResult_COption_KeyPairZNoneZ _res_conv = *(LDKCResult_COption_KeyPairZNoneZ*)(_res_ptr);
26516         FREE(untag_ptr(_res));
26517         CResult_COption_KeyPairZNoneZ_free(_res_conv);
26518 }
26519
26520 static inline uint64_t CResult_COption_KeyPairZNoneZ_clone_ptr(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR arg) {
26521         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26522         *ret_conv = CResult_COption_KeyPairZNoneZ_clone(arg);
26523         return tag_ptr(ret_conv, true);
26524 }
26525 int64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_clone_ptr"))) TS_CResult_COption_KeyPairZNoneZ_clone_ptr(uint64_t arg) {
26526         LDKCResult_COption_KeyPairZNoneZ* arg_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(arg);
26527         int64_t ret_conv = CResult_COption_KeyPairZNoneZ_clone_ptr(arg_conv);
26528         return ret_conv;
26529 }
26530
26531 uint64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_clone"))) TS_CResult_COption_KeyPairZNoneZ_clone(uint64_t orig) {
26532         LDKCResult_COption_KeyPairZNoneZ* orig_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(orig);
26533         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26534         *ret_conv = CResult_COption_KeyPairZNoneZ_clone(orig_conv);
26535         return tag_ptr(ret_conv, true);
26536 }
26537
26538 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
26539         LDKInvoiceError o_conv;
26540         o_conv.inner = untag_ptr(o);
26541         o_conv.is_owned = ptr_is_owned(o);
26542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26543         o_conv = InvoiceError_clone(&o_conv);
26544         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
26545         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
26546         return tag_ptr(ret_conv, true);
26547 }
26548
26549 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
26550         void* e_ptr = untag_ptr(e);
26551         CHECK_ACCESS(e_ptr);
26552         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26553         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26554         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
26555         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
26556         return tag_ptr(ret_conv, true);
26557 }
26558
26559 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
26560         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
26561         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
26562         return ret_conv;
26563 }
26564
26565 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
26566         if (!ptr_is_owned(_res)) return;
26567         void* _res_ptr = untag_ptr(_res);
26568         CHECK_ACCESS(_res_ptr);
26569         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
26570         FREE(untag_ptr(_res));
26571         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
26572 }
26573
26574 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
26575         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
26576         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
26577         return tag_ptr(ret_conv, true);
26578 }
26579 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
26580         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
26581         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
26582         return ret_conv;
26583 }
26584
26585 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
26586         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
26587         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
26588         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
26589         return tag_ptr(ret_conv, true);
26590 }
26591
26592 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
26593         void* o_ptr = untag_ptr(o);
26594         CHECK_ACCESS(o_ptr);
26595         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
26596         if (o_conv.free == LDKFilter_JCalls_free) {
26597                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26598                 LDKFilter_JCalls_cloned(&o_conv);
26599         }
26600         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
26601         *ret_copy = COption_FilterZ_some(o_conv);
26602         uint64_t ret_ref = tag_ptr(ret_copy, true);
26603         return ret_ref;
26604 }
26605
26606 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
26607         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
26608         *ret_copy = COption_FilterZ_none();
26609         uint64_t ret_ref = tag_ptr(ret_copy, true);
26610         return ret_ref;
26611 }
26612
26613 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
26614         if (!ptr_is_owned(_res)) return;
26615         void* _res_ptr = untag_ptr(_res);
26616         CHECK_ACCESS(_res_ptr);
26617         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
26618         FREE(untag_ptr(_res));
26619         COption_FilterZ_free(_res_conv);
26620 }
26621
26622 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
26623         LDKLockedChannelMonitor o_conv;
26624         o_conv.inner = untag_ptr(o);
26625         o_conv.is_owned = ptr_is_owned(o);
26626         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26627         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
26628         
26629         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
26630         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
26631         return tag_ptr(ret_conv, true);
26632 }
26633
26634 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
26635         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
26636         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
26637         return tag_ptr(ret_conv, true);
26638 }
26639
26640 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
26641         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
26642         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
26643         return ret_conv;
26644 }
26645
26646 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
26647         if (!ptr_is_owned(_res)) return;
26648         void* _res_ptr = untag_ptr(_res);
26649         CHECK_ACCESS(_res_ptr);
26650         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
26651         FREE(untag_ptr(_res));
26652         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
26653 }
26654
26655 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
26656         LDKCVec_OutPointZ _res_constr;
26657         _res_constr.datalen = _res->arr_len;
26658         if (_res_constr.datalen > 0)
26659                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
26660         else
26661                 _res_constr.data = NULL;
26662         uint64_t* _res_vals = _res->elems;
26663         for (size_t k = 0; k < _res_constr.datalen; k++) {
26664                 uint64_t _res_conv_10 = _res_vals[k];
26665                 LDKOutPoint _res_conv_10_conv;
26666                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
26667                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
26668                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
26669                 _res_constr.data[k] = _res_conv_10_conv;
26670         }
26671         FREE(_res);
26672         CVec_OutPointZ_free(_res_constr);
26673 }
26674
26675 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
26676         LDKCVec_MonitorUpdateIdZ _res_constr;
26677         _res_constr.datalen = _res->arr_len;
26678         if (_res_constr.datalen > 0)
26679                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
26680         else
26681                 _res_constr.data = NULL;
26682         uint64_t* _res_vals = _res->elems;
26683         for (size_t r = 0; r < _res_constr.datalen; r++) {
26684                 uint64_t _res_conv_17 = _res_vals[r];
26685                 LDKMonitorUpdateId _res_conv_17_conv;
26686                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
26687                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
26688                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
26689                 _res_constr.data[r] = _res_conv_17_conv;
26690         }
26691         FREE(_res);
26692         CVec_MonitorUpdateIdZ_free(_res_constr);
26693 }
26694
26695 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
26696         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26697         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
26698         return tag_ptr(ret_conv, true);
26699 }
26700 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
26701         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
26702         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
26703         return ret_conv;
26704 }
26705
26706 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
26707         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
26708         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26709         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
26710         return tag_ptr(ret_conv, true);
26711 }
26712
26713 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
26714         LDKOutPoint a_conv;
26715         a_conv.inner = untag_ptr(a);
26716         a_conv.is_owned = ptr_is_owned(a);
26717         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26718         a_conv = OutPoint_clone(&a_conv);
26719         LDKCVec_MonitorUpdateIdZ b_constr;
26720         b_constr.datalen = b->arr_len;
26721         if (b_constr.datalen > 0)
26722                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
26723         else
26724                 b_constr.data = NULL;
26725         uint64_t* b_vals = b->elems;
26726         for (size_t r = 0; r < b_constr.datalen; r++) {
26727                 uint64_t b_conv_17 = b_vals[r];
26728                 LDKMonitorUpdateId b_conv_17_conv;
26729                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
26730                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
26731                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
26732                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
26733                 b_constr.data[r] = b_conv_17_conv;
26734         }
26735         FREE(b);
26736         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26737         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
26738         return tag_ptr(ret_conv, true);
26739 }
26740
26741 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
26742         if (!ptr_is_owned(_res)) return;
26743         void* _res_ptr = untag_ptr(_res);
26744         CHECK_ACCESS(_res_ptr);
26745         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
26746         FREE(untag_ptr(_res));
26747         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
26748 }
26749
26750 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
26751         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
26752         _res_constr.datalen = _res->arr_len;
26753         if (_res_constr.datalen > 0)
26754                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
26755         else
26756                 _res_constr.data = NULL;
26757         uint64_t* _res_vals = _res->elems;
26758         for (size_t p = 0; p < _res_constr.datalen; p++) {
26759                 uint64_t _res_conv_41 = _res_vals[p];
26760                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
26761                 CHECK_ACCESS(_res_conv_41_ptr);
26762                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
26763                 FREE(untag_ptr(_res_conv_41));
26764                 _res_constr.data[p] = _res_conv_41_conv;
26765         }
26766         FREE(_res);
26767         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
26768 }
26769
26770 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
26771         LDKCVec_PhantomRouteHintsZ _res_constr;
26772         _res_constr.datalen = _res->arr_len;
26773         if (_res_constr.datalen > 0)
26774                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
26775         else
26776                 _res_constr.data = NULL;
26777         uint64_t* _res_vals = _res->elems;
26778         for (size_t t = 0; t < _res_constr.datalen; t++) {
26779                 uint64_t _res_conv_19 = _res_vals[t];
26780                 LDKPhantomRouteHints _res_conv_19_conv;
26781                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
26782                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
26783                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
26784                 _res_constr.data[t] = _res_conv_19_conv;
26785         }
26786         FREE(_res);
26787         CVec_PhantomRouteHintsZ_free(_res_constr);
26788 }
26789
26790 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
26791         LDKBolt11Invoice o_conv;
26792         o_conv.inner = untag_ptr(o);
26793         o_conv.is_owned = ptr_is_owned(o);
26794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26795         o_conv = Bolt11Invoice_clone(&o_conv);
26796         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26797         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
26798         return tag_ptr(ret_conv, true);
26799 }
26800
26801 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
26802         void* e_ptr = untag_ptr(e);
26803         CHECK_ACCESS(e_ptr);
26804         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
26805         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
26806         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26807         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
26808         return tag_ptr(ret_conv, true);
26809 }
26810
26811 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
26812         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
26813         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
26814         return ret_conv;
26815 }
26816
26817 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
26818         if (!ptr_is_owned(_res)) return;
26819         void* _res_ptr = untag_ptr(_res);
26820         CHECK_ACCESS(_res_ptr);
26821         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
26822         FREE(untag_ptr(_res));
26823         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
26824 }
26825
26826 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
26827         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26828         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
26829         return tag_ptr(ret_conv, true);
26830 }
26831 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
26832         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
26833         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
26834         return ret_conv;
26835 }
26836
26837 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
26838         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
26839         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26840         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
26841         return tag_ptr(ret_conv, true);
26842 }
26843
26844 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
26845         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
26846         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
26847         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
26848         return tag_ptr(ret_conv, true);
26849 }
26850
26851 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
26852         void* e_ptr = untag_ptr(e);
26853         CHECK_ACCESS(e_ptr);
26854         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
26855         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
26856         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
26857         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
26858         return tag_ptr(ret_conv, true);
26859 }
26860
26861 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
26862         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
26863         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
26864         return ret_conv;
26865 }
26866
26867 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
26868         if (!ptr_is_owned(_res)) return;
26869         void* _res_ptr = untag_ptr(_res);
26870         CHECK_ACCESS(_res_ptr);
26871         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
26872         FREE(untag_ptr(_res));
26873         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
26874 }
26875
26876 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
26877         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
26878         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
26879         return tag_ptr(ret_conv, true);
26880 }
26881 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
26882         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
26883         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
26884         return ret_conv;
26885 }
26886
26887 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
26888         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
26889         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
26890         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
26891         return tag_ptr(ret_conv, true);
26892 }
26893
26894 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
26895         LDKBolt11Invoice o_conv;
26896         o_conv.inner = untag_ptr(o);
26897         o_conv.is_owned = ptr_is_owned(o);
26898         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26899         o_conv = Bolt11Invoice_clone(&o_conv);
26900         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
26901         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
26902         return tag_ptr(ret_conv, true);
26903 }
26904
26905 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
26906         void* e_ptr = untag_ptr(e);
26907         CHECK_ACCESS(e_ptr);
26908         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
26909         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
26910         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
26911         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
26912         return tag_ptr(ret_conv, true);
26913 }
26914
26915 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
26916         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
26917         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
26918         return ret_conv;
26919 }
26920
26921 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
26922         if (!ptr_is_owned(_res)) return;
26923         void* _res_ptr = untag_ptr(_res);
26924         CHECK_ACCESS(_res_ptr);
26925         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
26926         FREE(untag_ptr(_res));
26927         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
26928 }
26929
26930 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
26931         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
26932         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
26933         return tag_ptr(ret_conv, true);
26934 }
26935 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
26936         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
26937         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
26938         return ret_conv;
26939 }
26940
26941 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
26942         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
26943         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
26944         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
26945         return tag_ptr(ret_conv, true);
26946 }
26947
26948 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
26949         LDKSignedRawBolt11Invoice o_conv;
26950         o_conv.inner = untag_ptr(o);
26951         o_conv.is_owned = ptr_is_owned(o);
26952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26953         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
26954         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
26955         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
26956         return tag_ptr(ret_conv, true);
26957 }
26958
26959 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
26960         void* e_ptr = untag_ptr(e);
26961         CHECK_ACCESS(e_ptr);
26962         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
26963         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
26964         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
26965         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
26966         return tag_ptr(ret_conv, true);
26967 }
26968
26969 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
26970         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
26971         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
26972         return ret_conv;
26973 }
26974
26975 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
26976         if (!ptr_is_owned(_res)) return;
26977         void* _res_ptr = untag_ptr(_res);
26978         CHECK_ACCESS(_res_ptr);
26979         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
26980         FREE(untag_ptr(_res));
26981         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
26982 }
26983
26984 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
26985         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
26986         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
26987         return tag_ptr(ret_conv, true);
26988 }
26989 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
26990         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
26991         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
26992         return ret_conv;
26993 }
26994
26995 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
26996         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
26997         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
26998         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
26999         return tag_ptr(ret_conv, true);
27000 }
27001
27002 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
27003         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27004         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
27005         return tag_ptr(ret_conv, true);
27006 }
27007 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
27008         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
27009         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
27010         return ret_conv;
27011 }
27012
27013 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
27014         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
27015         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27016         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
27017         return tag_ptr(ret_conv, true);
27018 }
27019
27020 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
27021         LDKRawBolt11Invoice a_conv;
27022         a_conv.inner = untag_ptr(a);
27023         a_conv.is_owned = ptr_is_owned(a);
27024         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27025         a_conv = RawBolt11Invoice_clone(&a_conv);
27026         LDKThirtyTwoBytes b_ref;
27027         CHECK(b->arr_len == 32);
27028         memcpy(b_ref.data, b->elems, 32); FREE(b);
27029         LDKBolt11InvoiceSignature c_conv;
27030         c_conv.inner = untag_ptr(c);
27031         c_conv.is_owned = ptr_is_owned(c);
27032         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27033         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
27034         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27035         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
27036         return tag_ptr(ret_conv, true);
27037 }
27038
27039 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
27040         if (!ptr_is_owned(_res)) return;
27041         void* _res_ptr = untag_ptr(_res);
27042         CHECK_ACCESS(_res_ptr);
27043         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
27044         FREE(untag_ptr(_res));
27045         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
27046 }
27047
27048 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
27049         LDKPayeePubKey o_conv;
27050         o_conv.inner = untag_ptr(o);
27051         o_conv.is_owned = ptr_is_owned(o);
27052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27053         o_conv = PayeePubKey_clone(&o_conv);
27054         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27055         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
27056         return tag_ptr(ret_conv, true);
27057 }
27058
27059 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
27060         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
27061         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27062         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
27063         return tag_ptr(ret_conv, true);
27064 }
27065
27066 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
27067         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
27068         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
27069         return ret_conv;
27070 }
27071
27072 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
27073         if (!ptr_is_owned(_res)) return;
27074         void* _res_ptr = untag_ptr(_res);
27075         CHECK_ACCESS(_res_ptr);
27076         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
27077         FREE(untag_ptr(_res));
27078         CResult_PayeePubKeyErrorZ_free(_res_conv);
27079 }
27080
27081 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
27082         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27083         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
27084         return tag_ptr(ret_conv, true);
27085 }
27086 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
27087         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
27088         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
27089         return ret_conv;
27090 }
27091
27092 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
27093         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
27094         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27095         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
27096         return tag_ptr(ret_conv, true);
27097 }
27098
27099 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
27100         LDKCVec_PrivateRouteZ _res_constr;
27101         _res_constr.datalen = _res->arr_len;
27102         if (_res_constr.datalen > 0)
27103                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
27104         else
27105                 _res_constr.data = NULL;
27106         uint64_t* _res_vals = _res->elems;
27107         for (size_t o = 0; o < _res_constr.datalen; o++) {
27108                 uint64_t _res_conv_14 = _res_vals[o];
27109                 LDKPrivateRoute _res_conv_14_conv;
27110                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
27111                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
27112                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
27113                 _res_constr.data[o] = _res_conv_14_conv;
27114         }
27115         FREE(_res);
27116         CVec_PrivateRouteZ_free(_res_constr);
27117 }
27118
27119 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
27120         LDKPositiveTimestamp o_conv;
27121         o_conv.inner = untag_ptr(o);
27122         o_conv.is_owned = ptr_is_owned(o);
27123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27124         o_conv = PositiveTimestamp_clone(&o_conv);
27125         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27126         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
27127         return tag_ptr(ret_conv, true);
27128 }
27129
27130 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
27131         LDKCreationError e_conv = LDKCreationError_from_js(e);
27132         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27133         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
27134         return tag_ptr(ret_conv, true);
27135 }
27136
27137 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
27138         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
27139         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
27140         return ret_conv;
27141 }
27142
27143 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
27144         if (!ptr_is_owned(_res)) return;
27145         void* _res_ptr = untag_ptr(_res);
27146         CHECK_ACCESS(_res_ptr);
27147         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
27148         FREE(untag_ptr(_res));
27149         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
27150 }
27151
27152 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
27153         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27154         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
27155         return tag_ptr(ret_conv, true);
27156 }
27157 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
27158         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
27159         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
27160         return ret_conv;
27161 }
27162
27163 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
27164         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
27165         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27166         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
27167         return tag_ptr(ret_conv, true);
27168 }
27169
27170 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
27171         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27172         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
27173         return tag_ptr(ret_conv, true);
27174 }
27175
27176 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
27177         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27178         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27179         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
27180         return tag_ptr(ret_conv, true);
27181 }
27182
27183 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
27184         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
27185         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
27186         return ret_conv;
27187 }
27188
27189 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
27190         if (!ptr_is_owned(_res)) return;
27191         void* _res_ptr = untag_ptr(_res);
27192         CHECK_ACCESS(_res_ptr);
27193         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
27194         FREE(untag_ptr(_res));
27195         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
27196 }
27197
27198 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
27199         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27200         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
27201         return tag_ptr(ret_conv, true);
27202 }
27203 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
27204         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
27205         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
27206         return ret_conv;
27207 }
27208
27209 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
27210         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
27211         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27212         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
27213         return tag_ptr(ret_conv, true);
27214 }
27215
27216 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
27217         LDKBolt11Invoice o_conv;
27218         o_conv.inner = untag_ptr(o);
27219         o_conv.is_owned = ptr_is_owned(o);
27220         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27221         o_conv = Bolt11Invoice_clone(&o_conv);
27222         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27223         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
27224         return tag_ptr(ret_conv, true);
27225 }
27226
27227 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
27228         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27229         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27230         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
27231         return tag_ptr(ret_conv, true);
27232 }
27233
27234 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
27235         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
27236         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
27237         return ret_conv;
27238 }
27239
27240 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
27241         if (!ptr_is_owned(_res)) return;
27242         void* _res_ptr = untag_ptr(_res);
27243         CHECK_ACCESS(_res_ptr);
27244         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
27245         FREE(untag_ptr(_res));
27246         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
27247 }
27248
27249 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
27250         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27251         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
27252         return tag_ptr(ret_conv, true);
27253 }
27254 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
27255         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
27256         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
27257         return ret_conv;
27258 }
27259
27260 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
27261         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
27262         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27263         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
27264         return tag_ptr(ret_conv, true);
27265 }
27266
27267 void  __attribute__((export_name("TS_CVec_AddressZ_free"))) TS_CVec_AddressZ_free(ptrArray _res) {
27268         LDKCVec_AddressZ _res_constr;
27269         _res_constr.datalen = _res->arr_len;
27270         if (_res_constr.datalen > 0)
27271                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_AddressZ Elements");
27272         else
27273                 _res_constr.data = NULL;
27274         jstring* _res_vals = (void*) _res->elems;
27275         for (size_t i = 0; i < _res_constr.datalen; i++) {
27276                 jstring _res_conv_8 = _res_vals[i];
27277                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
27278                 _res_constr.data[i] = dummy;
27279         }
27280         FREE(_res);
27281         CVec_AddressZ_free(_res_constr);
27282 }
27283
27284 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
27285         LDKDescription o_conv;
27286         o_conv.inner = untag_ptr(o);
27287         o_conv.is_owned = ptr_is_owned(o);
27288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27289         o_conv = Description_clone(&o_conv);
27290         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27291         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
27292         return tag_ptr(ret_conv, true);
27293 }
27294
27295 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
27296         LDKCreationError e_conv = LDKCreationError_from_js(e);
27297         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27298         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
27299         return tag_ptr(ret_conv, true);
27300 }
27301
27302 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
27303         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
27304         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
27305         return ret_conv;
27306 }
27307
27308 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
27309         if (!ptr_is_owned(_res)) return;
27310         void* _res_ptr = untag_ptr(_res);
27311         CHECK_ACCESS(_res_ptr);
27312         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
27313         FREE(untag_ptr(_res));
27314         CResult_DescriptionCreationErrorZ_free(_res_conv);
27315 }
27316
27317 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
27318         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27319         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
27320         return tag_ptr(ret_conv, true);
27321 }
27322 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
27323         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
27324         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
27325         return ret_conv;
27326 }
27327
27328 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
27329         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
27330         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27331         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
27332         return tag_ptr(ret_conv, true);
27333 }
27334
27335 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
27336         LDKPrivateRoute o_conv;
27337         o_conv.inner = untag_ptr(o);
27338         o_conv.is_owned = ptr_is_owned(o);
27339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27340         o_conv = PrivateRoute_clone(&o_conv);
27341         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27342         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
27343         return tag_ptr(ret_conv, true);
27344 }
27345
27346 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
27347         LDKCreationError e_conv = LDKCreationError_from_js(e);
27348         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27349         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
27350         return tag_ptr(ret_conv, true);
27351 }
27352
27353 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
27354         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
27355         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
27356         return ret_conv;
27357 }
27358
27359 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
27360         if (!ptr_is_owned(_res)) return;
27361         void* _res_ptr = untag_ptr(_res);
27362         CHECK_ACCESS(_res_ptr);
27363         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
27364         FREE(untag_ptr(_res));
27365         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
27366 }
27367
27368 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
27369         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27370         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
27371         return tag_ptr(ret_conv, true);
27372 }
27373 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
27374         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
27375         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
27376         return ret_conv;
27377 }
27378
27379 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
27380         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
27381         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27382         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
27383         return tag_ptr(ret_conv, true);
27384 }
27385
27386 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
27387         if (!ptr_is_owned(this_ptr)) return;
27388         void* this_ptr_ptr = untag_ptr(this_ptr);
27389         CHECK_ACCESS(this_ptr_ptr);
27390         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
27391         FREE(untag_ptr(this_ptr));
27392         APIError_free(this_ptr_conv);
27393 }
27394
27395 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
27396         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27397         *ret_copy = APIError_clone(arg);
27398         uint64_t ret_ref = tag_ptr(ret_copy, true);
27399         return ret_ref;
27400 }
27401 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
27402         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
27403         int64_t ret_conv = APIError_clone_ptr(arg_conv);
27404         return ret_conv;
27405 }
27406
27407 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
27408         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
27409         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27410         *ret_copy = APIError_clone(orig_conv);
27411         uint64_t ret_ref = tag_ptr(ret_copy, true);
27412         return ret_ref;
27413 }
27414
27415 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
27416         LDKStr err_conv = str_ref_to_owned_c(err);
27417         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27418         *ret_copy = APIError_apimisuse_error(err_conv);
27419         uint64_t ret_ref = tag_ptr(ret_copy, true);
27420         return ret_ref;
27421 }
27422
27423 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
27424         LDKStr err_conv = str_ref_to_owned_c(err);
27425         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27426         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
27427         uint64_t ret_ref = tag_ptr(ret_copy, true);
27428         return ret_ref;
27429 }
27430
27431 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
27432         LDKStr err_conv = str_ref_to_owned_c(err);
27433         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27434         *ret_copy = APIError_invalid_route(err_conv);
27435         uint64_t ret_ref = tag_ptr(ret_copy, true);
27436         return ret_ref;
27437 }
27438
27439 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
27440         LDKStr err_conv = str_ref_to_owned_c(err);
27441         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27442         *ret_copy = APIError_channel_unavailable(err_conv);
27443         uint64_t ret_ref = tag_ptr(ret_copy, true);
27444         return ret_ref;
27445 }
27446
27447 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
27448         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27449         *ret_copy = APIError_monitor_update_in_progress();
27450         uint64_t ret_ref = tag_ptr(ret_copy, true);
27451         return ret_ref;
27452 }
27453
27454 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
27455         LDKShutdownScript script_conv;
27456         script_conv.inner = untag_ptr(script);
27457         script_conv.is_owned = ptr_is_owned(script);
27458         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
27459         script_conv = ShutdownScript_clone(&script_conv);
27460         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27461         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
27462         uint64_t ret_ref = tag_ptr(ret_copy, true);
27463         return ret_ref;
27464 }
27465
27466 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
27467         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
27468         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
27469         jboolean ret_conv = APIError_eq(a_conv, b_conv);
27470         return ret_conv;
27471 }
27472
27473 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
27474         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
27475         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
27476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27478         CVec_u8Z_free(ret_var);
27479         return ret_arr;
27480 }
27481
27482 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
27483         LDKu8slice ser_ref;
27484         ser_ref.datalen = ser->arr_len;
27485         ser_ref.data = ser->elems;
27486         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27487         *ret_conv = APIError_read(ser_ref);
27488         FREE(ser);
27489         return tag_ptr(ret_conv, true);
27490 }
27491
27492 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
27493         LDKBigSize this_obj_conv;
27494         this_obj_conv.inner = untag_ptr(this_obj);
27495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27497         BigSize_free(this_obj_conv);
27498 }
27499
27500 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
27501         LDKBigSize this_ptr_conv;
27502         this_ptr_conv.inner = untag_ptr(this_ptr);
27503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27505         this_ptr_conv.is_owned = false;
27506         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
27507         return ret_conv;
27508 }
27509
27510 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
27511         LDKBigSize this_ptr_conv;
27512         this_ptr_conv.inner = untag_ptr(this_ptr);
27513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27515         this_ptr_conv.is_owned = false;
27516         BigSize_set_a(&this_ptr_conv, val);
27517 }
27518
27519 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
27520         LDKBigSize ret_var = BigSize_new(a_arg);
27521         uint64_t ret_ref = 0;
27522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27524         return ret_ref;
27525 }
27526
27527 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
27528         LDKBigSize ret_var = BigSize_clone(arg);
27529         uint64_t ret_ref = 0;
27530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27532         return ret_ref;
27533 }
27534 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
27535         LDKBigSize arg_conv;
27536         arg_conv.inner = untag_ptr(arg);
27537         arg_conv.is_owned = ptr_is_owned(arg);
27538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27539         arg_conv.is_owned = false;
27540         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
27541         return ret_conv;
27542 }
27543
27544 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
27545         LDKBigSize orig_conv;
27546         orig_conv.inner = untag_ptr(orig);
27547         orig_conv.is_owned = ptr_is_owned(orig);
27548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27549         orig_conv.is_owned = false;
27550         LDKBigSize ret_var = BigSize_clone(&orig_conv);
27551         uint64_t ret_ref = 0;
27552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27554         return ret_ref;
27555 }
27556
27557 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
27558         LDKBigSize o_conv;
27559         o_conv.inner = untag_ptr(o);
27560         o_conv.is_owned = ptr_is_owned(o);
27561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27562         o_conv.is_owned = false;
27563         int64_t ret_conv = BigSize_hash(&o_conv);
27564         return ret_conv;
27565 }
27566
27567 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
27568         LDKBigSize a_conv;
27569         a_conv.inner = untag_ptr(a);
27570         a_conv.is_owned = ptr_is_owned(a);
27571         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27572         a_conv.is_owned = false;
27573         LDKBigSize b_conv;
27574         b_conv.inner = untag_ptr(b);
27575         b_conv.is_owned = ptr_is_owned(b);
27576         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27577         b_conv.is_owned = false;
27578         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
27579         return ret_conv;
27580 }
27581
27582 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
27583         LDKBigSize obj_conv;
27584         obj_conv.inner = untag_ptr(obj);
27585         obj_conv.is_owned = ptr_is_owned(obj);
27586         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27587         obj_conv.is_owned = false;
27588         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
27589         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27590         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27591         CVec_u8Z_free(ret_var);
27592         return ret_arr;
27593 }
27594
27595 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
27596         LDKu8slice ser_ref;
27597         ser_ref.datalen = ser->arr_len;
27598         ser_ref.data = ser->elems;
27599         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27600         *ret_conv = BigSize_read(ser_ref);
27601         FREE(ser);
27602         return tag_ptr(ret_conv, true);
27603 }
27604
27605 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
27606         LDKHostname this_obj_conv;
27607         this_obj_conv.inner = untag_ptr(this_obj);
27608         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27610         Hostname_free(this_obj_conv);
27611 }
27612
27613 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
27614         LDKHostname ret_var = Hostname_clone(arg);
27615         uint64_t ret_ref = 0;
27616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27618         return ret_ref;
27619 }
27620 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
27621         LDKHostname arg_conv;
27622         arg_conv.inner = untag_ptr(arg);
27623         arg_conv.is_owned = ptr_is_owned(arg);
27624         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27625         arg_conv.is_owned = false;
27626         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
27627         return ret_conv;
27628 }
27629
27630 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
27631         LDKHostname orig_conv;
27632         orig_conv.inner = untag_ptr(orig);
27633         orig_conv.is_owned = ptr_is_owned(orig);
27634         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27635         orig_conv.is_owned = false;
27636         LDKHostname ret_var = Hostname_clone(&orig_conv);
27637         uint64_t ret_ref = 0;
27638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27640         return ret_ref;
27641 }
27642
27643 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
27644         LDKHostname a_conv;
27645         a_conv.inner = untag_ptr(a);
27646         a_conv.is_owned = ptr_is_owned(a);
27647         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27648         a_conv.is_owned = false;
27649         LDKHostname b_conv;
27650         b_conv.inner = untag_ptr(b);
27651         b_conv.is_owned = ptr_is_owned(b);
27652         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27653         b_conv.is_owned = false;
27654         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
27655         return ret_conv;
27656 }
27657
27658 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
27659         LDKHostname this_arg_conv;
27660         this_arg_conv.inner = untag_ptr(this_arg);
27661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27663         this_arg_conv.is_owned = false;
27664         int8_t ret_conv = Hostname_len(&this_arg_conv);
27665         return ret_conv;
27666 }
27667
27668 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
27669         LDKHostname obj_conv;
27670         obj_conv.inner = untag_ptr(obj);
27671         obj_conv.is_owned = ptr_is_owned(obj);
27672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27673         obj_conv.is_owned = false;
27674         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
27675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27677         CVec_u8Z_free(ret_var);
27678         return ret_arr;
27679 }
27680
27681 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
27682         LDKu8slice ser_ref;
27683         ser_ref.datalen = ser->arr_len;
27684         ser_ref.data = ser->elems;
27685         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27686         *ret_conv = Hostname_read(ser_ref);
27687         FREE(ser);
27688         return tag_ptr(ret_conv, true);
27689 }
27690
27691 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
27692         LDKTransactionU16LenLimited this_obj_conv;
27693         this_obj_conv.inner = untag_ptr(this_obj);
27694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27696         TransactionU16LenLimited_free(this_obj_conv);
27697 }
27698
27699 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
27700         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
27701         uint64_t ret_ref = 0;
27702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27704         return ret_ref;
27705 }
27706 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
27707         LDKTransactionU16LenLimited arg_conv;
27708         arg_conv.inner = untag_ptr(arg);
27709         arg_conv.is_owned = ptr_is_owned(arg);
27710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27711         arg_conv.is_owned = false;
27712         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
27713         return ret_conv;
27714 }
27715
27716 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
27717         LDKTransactionU16LenLimited orig_conv;
27718         orig_conv.inner = untag_ptr(orig);
27719         orig_conv.is_owned = ptr_is_owned(orig);
27720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27721         orig_conv.is_owned = false;
27722         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
27723         uint64_t ret_ref = 0;
27724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27726         return ret_ref;
27727 }
27728
27729 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
27730         LDKTransactionU16LenLimited a_conv;
27731         a_conv.inner = untag_ptr(a);
27732         a_conv.is_owned = ptr_is_owned(a);
27733         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27734         a_conv.is_owned = false;
27735         LDKTransactionU16LenLimited b_conv;
27736         b_conv.inner = untag_ptr(b);
27737         b_conv.is_owned = ptr_is_owned(b);
27738         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27739         b_conv.is_owned = false;
27740         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
27741         return ret_conv;
27742 }
27743
27744 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
27745         LDKTransaction transaction_ref;
27746         transaction_ref.datalen = transaction->arr_len;
27747         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
27748         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
27749         transaction_ref.data_is_owned = true;
27750         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27751         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
27752         return tag_ptr(ret_conv, true);
27753 }
27754
27755 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
27756         LDKTransactionU16LenLimited this_arg_conv;
27757         this_arg_conv.inner = untag_ptr(this_arg);
27758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27760         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
27761         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
27762         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27763         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27764         Transaction_free(ret_var);
27765         return ret_arr;
27766 }
27767
27768 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
27769         LDKTransactionU16LenLimited obj_conv;
27770         obj_conv.inner = untag_ptr(obj);
27771         obj_conv.is_owned = ptr_is_owned(obj);
27772         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27773         obj_conv.is_owned = false;
27774         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
27775         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27776         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27777         CVec_u8Z_free(ret_var);
27778         return ret_arr;
27779 }
27780
27781 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
27782         LDKu8slice ser_ref;
27783         ser_ref.datalen = ser->arr_len;
27784         ser_ref.data = ser->elems;
27785         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27786         *ret_conv = TransactionU16LenLimited_read(ser_ref);
27787         FREE(ser);
27788         return tag_ptr(ret_conv, true);
27789 }
27790
27791 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
27792         LDKu8slice msg_ref;
27793         msg_ref.datalen = msg->arr_len;
27794         msg_ref.data = msg->elems;
27795         uint8_t sk_arr[32];
27796         CHECK(sk->arr_len == 32);
27797         memcpy(sk_arr, sk->elems, 32); FREE(sk);
27798         uint8_t (*sk_ref)[32] = &sk_arr;
27799         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
27800         *ret_conv = sign(msg_ref, sk_ref);
27801         FREE(msg);
27802         return tag_ptr(ret_conv, true);
27803 }
27804
27805 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
27806         LDKu8slice msg_ref;
27807         msg_ref.datalen = msg->arr_len;
27808         msg_ref.data = msg->elems;
27809         LDKStr sig_conv = str_ref_to_owned_c(sig);
27810         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
27811         *ret_conv = recover_pk(msg_ref, sig_conv);
27812         FREE(msg);
27813         return tag_ptr(ret_conv, true);
27814 }
27815
27816 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
27817         LDKu8slice msg_ref;
27818         msg_ref.datalen = msg->arr_len;
27819         msg_ref.data = msg->elems;
27820         LDKStr sig_conv = str_ref_to_owned_c(sig);
27821         LDKPublicKey pk_ref;
27822         CHECK(pk->arr_len == 33);
27823         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
27824         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
27825         FREE(msg);
27826         return ret_conv;
27827 }
27828
27829 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
27830         LDKu8slice hrp_bytes_ref;
27831         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
27832         hrp_bytes_ref.data = hrp_bytes->elems;
27833         LDKCVec_U5Z data_without_signature_constr;
27834         data_without_signature_constr.datalen = data_without_signature->arr_len;
27835         if (data_without_signature_constr.datalen > 0)
27836                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
27837         else
27838                 data_without_signature_constr.data = NULL;
27839         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
27840         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
27841                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
27842                 
27843                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
27844         }
27845         FREE(data_without_signature);
27846         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
27847         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27848         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27849         CVec_u8Z_free(ret_var);
27850         FREE(hrp_bytes);
27851         return ret_arr;
27852 }
27853
27854 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
27855         if (!ptr_is_owned(this_ptr)) return;
27856         void* this_ptr_ptr = untag_ptr(this_ptr);
27857         CHECK_ACCESS(this_ptr_ptr);
27858         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
27859         FREE(untag_ptr(this_ptr));
27860         Persister_free(this_ptr_conv);
27861 }
27862
27863 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
27864         LDKUntrustedString this_obj_conv;
27865         this_obj_conv.inner = untag_ptr(this_obj);
27866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27868         UntrustedString_free(this_obj_conv);
27869 }
27870
27871 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
27872         LDKUntrustedString this_ptr_conv;
27873         this_ptr_conv.inner = untag_ptr(this_ptr);
27874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27876         this_ptr_conv.is_owned = false;
27877         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
27878         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27879         Str_free(ret_str);
27880         return ret_conv;
27881 }
27882
27883 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
27884         LDKUntrustedString this_ptr_conv;
27885         this_ptr_conv.inner = untag_ptr(this_ptr);
27886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27888         this_ptr_conv.is_owned = false;
27889         LDKStr val_conv = str_ref_to_owned_c(val);
27890         UntrustedString_set_a(&this_ptr_conv, val_conv);
27891 }
27892
27893 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
27894         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
27895         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
27896         uint64_t ret_ref = 0;
27897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27899         return ret_ref;
27900 }
27901
27902 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
27903         LDKUntrustedString ret_var = UntrustedString_clone(arg);
27904         uint64_t ret_ref = 0;
27905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27907         return ret_ref;
27908 }
27909 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
27910         LDKUntrustedString arg_conv;
27911         arg_conv.inner = untag_ptr(arg);
27912         arg_conv.is_owned = ptr_is_owned(arg);
27913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27914         arg_conv.is_owned = false;
27915         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
27916         return ret_conv;
27917 }
27918
27919 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
27920         LDKUntrustedString orig_conv;
27921         orig_conv.inner = untag_ptr(orig);
27922         orig_conv.is_owned = ptr_is_owned(orig);
27923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27924         orig_conv.is_owned = false;
27925         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
27926         uint64_t ret_ref = 0;
27927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27929         return ret_ref;
27930 }
27931
27932 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
27933         LDKUntrustedString a_conv;
27934         a_conv.inner = untag_ptr(a);
27935         a_conv.is_owned = ptr_is_owned(a);
27936         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27937         a_conv.is_owned = false;
27938         LDKUntrustedString b_conv;
27939         b_conv.inner = untag_ptr(b);
27940         b_conv.is_owned = ptr_is_owned(b);
27941         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27942         b_conv.is_owned = false;
27943         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
27944         return ret_conv;
27945 }
27946
27947 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
27948         LDKUntrustedString obj_conv;
27949         obj_conv.inner = untag_ptr(obj);
27950         obj_conv.is_owned = ptr_is_owned(obj);
27951         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27952         obj_conv.is_owned = false;
27953         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
27954         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27955         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27956         CVec_u8Z_free(ret_var);
27957         return ret_arr;
27958 }
27959
27960 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
27961         LDKu8slice ser_ref;
27962         ser_ref.datalen = ser->arr_len;
27963         ser_ref.data = ser->elems;
27964         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
27965         *ret_conv = UntrustedString_read(ser_ref);
27966         FREE(ser);
27967         return tag_ptr(ret_conv, true);
27968 }
27969
27970 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
27971         LDKPrintableString this_obj_conv;
27972         this_obj_conv.inner = untag_ptr(this_obj);
27973         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27975         PrintableString_free(this_obj_conv);
27976 }
27977
27978 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
27979         LDKPrintableString this_ptr_conv;
27980         this_ptr_conv.inner = untag_ptr(this_ptr);
27981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27983         this_ptr_conv.is_owned = false;
27984         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
27985         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27986         Str_free(ret_str);
27987         return ret_conv;
27988 }
27989
27990 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
27991         LDKPrintableString this_ptr_conv;
27992         this_ptr_conv.inner = untag_ptr(this_ptr);
27993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27995         this_ptr_conv.is_owned = false;
27996         LDKStr val_conv = str_ref_to_owned_c(val);
27997         PrintableString_set_a(&this_ptr_conv, val_conv);
27998 }
27999
28000 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
28001         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
28002         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
28003         uint64_t ret_ref = 0;
28004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28006         return ret_ref;
28007 }
28008
28009 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
28010         if (!ptr_is_owned(this_ptr)) return;
28011         void* this_ptr_ptr = untag_ptr(this_ptr);
28012         CHECK_ACCESS(this_ptr_ptr);
28013         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
28014         FREE(untag_ptr(this_ptr));
28015         FutureCallback_free(this_ptr_conv);
28016 }
28017
28018 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
28019         LDKFuture this_obj_conv;
28020         this_obj_conv.inner = untag_ptr(this_obj);
28021         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28023         Future_free(this_obj_conv);
28024 }
28025
28026 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
28027         LDKFuture ret_var = Future_clone(arg);
28028         uint64_t ret_ref = 0;
28029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28031         return ret_ref;
28032 }
28033 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
28034         LDKFuture arg_conv;
28035         arg_conv.inner = untag_ptr(arg);
28036         arg_conv.is_owned = ptr_is_owned(arg);
28037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28038         arg_conv.is_owned = false;
28039         int64_t ret_conv = Future_clone_ptr(&arg_conv);
28040         return ret_conv;
28041 }
28042
28043 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
28044         LDKFuture orig_conv;
28045         orig_conv.inner = untag_ptr(orig);
28046         orig_conv.is_owned = ptr_is_owned(orig);
28047         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28048         orig_conv.is_owned = false;
28049         LDKFuture ret_var = Future_clone(&orig_conv);
28050         uint64_t ret_ref = 0;
28051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28053         return ret_ref;
28054 }
28055
28056 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
28057         LDKFuture this_arg_conv;
28058         this_arg_conv.inner = untag_ptr(this_arg);
28059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28061         this_arg_conv.is_owned = false;
28062         void* callback_ptr = untag_ptr(callback);
28063         CHECK_ACCESS(callback_ptr);
28064         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
28065         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
28066                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28067                 LDKFutureCallback_JCalls_cloned(&callback_conv);
28068         }
28069         Future_register_callback_fn(&this_arg_conv, callback_conv);
28070 }
28071
28072 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
28073         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
28074         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
28075         return ret_conv;
28076 }
28077
28078 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
28079         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
28080         return ret_conv;
28081 }
28082
28083 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
28084         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
28085         return ret_conv;
28086 }
28087
28088 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
28089         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
28090         return ret_conv;
28091 }
28092
28093 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
28094         uint32_t ret_conv = LDKLevel_to_js(Level_info());
28095         return ret_conv;
28096 }
28097
28098 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
28099         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
28100         return ret_conv;
28101 }
28102
28103 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
28104         uint32_t ret_conv = LDKLevel_to_js(Level_error());
28105         return ret_conv;
28106 }
28107
28108 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
28109         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
28110         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
28111         jboolean ret_conv = Level_eq(a_conv, b_conv);
28112         return ret_conv;
28113 }
28114
28115 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
28116         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
28117         int64_t ret_conv = Level_hash(o_conv);
28118         return ret_conv;
28119 }
28120
28121 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
28122         uint32_t ret_conv = LDKLevel_to_js(Level_max());
28123         return ret_conv;
28124 }
28125
28126 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
28127         LDKRecord this_obj_conv;
28128         this_obj_conv.inner = untag_ptr(this_obj);
28129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28131         Record_free(this_obj_conv);
28132 }
28133
28134 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
28135         LDKRecord this_ptr_conv;
28136         this_ptr_conv.inner = untag_ptr(this_ptr);
28137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28139         this_ptr_conv.is_owned = false;
28140         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
28141         return ret_conv;
28142 }
28143
28144 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
28145         LDKRecord this_ptr_conv;
28146         this_ptr_conv.inner = untag_ptr(this_ptr);
28147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28149         this_ptr_conv.is_owned = false;
28150         LDKLevel val_conv = LDKLevel_from_js(val);
28151         Record_set_level(&this_ptr_conv, val_conv);
28152 }
28153
28154 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
28155         LDKRecord this_ptr_conv;
28156         this_ptr_conv.inner = untag_ptr(this_ptr);
28157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28159         this_ptr_conv.is_owned = false;
28160         LDKStr ret_str = Record_get_args(&this_ptr_conv);
28161         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28162         Str_free(ret_str);
28163         return ret_conv;
28164 }
28165
28166 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
28167         LDKRecord this_ptr_conv;
28168         this_ptr_conv.inner = untag_ptr(this_ptr);
28169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28171         this_ptr_conv.is_owned = false;
28172         LDKStr val_conv = str_ref_to_owned_c(val);
28173         Record_set_args(&this_ptr_conv, val_conv);
28174 }
28175
28176 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
28177         LDKRecord this_ptr_conv;
28178         this_ptr_conv.inner = untag_ptr(this_ptr);
28179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28181         this_ptr_conv.is_owned = false;
28182         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
28183         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28184         Str_free(ret_str);
28185         return ret_conv;
28186 }
28187
28188 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
28189         LDKRecord this_ptr_conv;
28190         this_ptr_conv.inner = untag_ptr(this_ptr);
28191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28193         this_ptr_conv.is_owned = false;
28194         LDKStr val_conv = str_ref_to_owned_c(val);
28195         Record_set_module_path(&this_ptr_conv, val_conv);
28196 }
28197
28198 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
28199         LDKRecord this_ptr_conv;
28200         this_ptr_conv.inner = untag_ptr(this_ptr);
28201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28203         this_ptr_conv.is_owned = false;
28204         LDKStr ret_str = Record_get_file(&this_ptr_conv);
28205         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28206         Str_free(ret_str);
28207         return ret_conv;
28208 }
28209
28210 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
28211         LDKRecord this_ptr_conv;
28212         this_ptr_conv.inner = untag_ptr(this_ptr);
28213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28215         this_ptr_conv.is_owned = false;
28216         LDKStr val_conv = str_ref_to_owned_c(val);
28217         Record_set_file(&this_ptr_conv, val_conv);
28218 }
28219
28220 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
28221         LDKRecord this_ptr_conv;
28222         this_ptr_conv.inner = untag_ptr(this_ptr);
28223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28225         this_ptr_conv.is_owned = false;
28226         int32_t ret_conv = Record_get_line(&this_ptr_conv);
28227         return ret_conv;
28228 }
28229
28230 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
28231         LDKRecord this_ptr_conv;
28232         this_ptr_conv.inner = untag_ptr(this_ptr);
28233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28235         this_ptr_conv.is_owned = false;
28236         Record_set_line(&this_ptr_conv, val);
28237 }
28238
28239 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
28240         LDKRecord ret_var = Record_clone(arg);
28241         uint64_t ret_ref = 0;
28242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28244         return ret_ref;
28245 }
28246 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
28247         LDKRecord arg_conv;
28248         arg_conv.inner = untag_ptr(arg);
28249         arg_conv.is_owned = ptr_is_owned(arg);
28250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28251         arg_conv.is_owned = false;
28252         int64_t ret_conv = Record_clone_ptr(&arg_conv);
28253         return ret_conv;
28254 }
28255
28256 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
28257         LDKRecord orig_conv;
28258         orig_conv.inner = untag_ptr(orig);
28259         orig_conv.is_owned = ptr_is_owned(orig);
28260         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28261         orig_conv.is_owned = false;
28262         LDKRecord ret_var = Record_clone(&orig_conv);
28263         uint64_t ret_ref = 0;
28264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28266         return ret_ref;
28267 }
28268
28269 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
28270         if (!ptr_is_owned(this_ptr)) return;
28271         void* this_ptr_ptr = untag_ptr(this_ptr);
28272         CHECK_ACCESS(this_ptr_ptr);
28273         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
28274         FREE(untag_ptr(this_ptr));
28275         Logger_free(this_ptr_conv);
28276 }
28277
28278 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
28279         LDKChannelHandshakeConfig this_obj_conv;
28280         this_obj_conv.inner = untag_ptr(this_obj);
28281         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28283         ChannelHandshakeConfig_free(this_obj_conv);
28284 }
28285
28286 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
28287         LDKChannelHandshakeConfig this_ptr_conv;
28288         this_ptr_conv.inner = untag_ptr(this_ptr);
28289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28291         this_ptr_conv.is_owned = false;
28292         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
28293         return ret_conv;
28294 }
28295
28296 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
28297         LDKChannelHandshakeConfig this_ptr_conv;
28298         this_ptr_conv.inner = untag_ptr(this_ptr);
28299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28301         this_ptr_conv.is_owned = false;
28302         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
28303 }
28304
28305 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
28306         LDKChannelHandshakeConfig this_ptr_conv;
28307         this_ptr_conv.inner = untag_ptr(this_ptr);
28308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28310         this_ptr_conv.is_owned = false;
28311         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
28312         return ret_conv;
28313 }
28314
28315 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) {
28316         LDKChannelHandshakeConfig this_ptr_conv;
28317         this_ptr_conv.inner = untag_ptr(this_ptr);
28318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28320         this_ptr_conv.is_owned = false;
28321         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
28322 }
28323
28324 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
28325         LDKChannelHandshakeConfig this_ptr_conv;
28326         this_ptr_conv.inner = untag_ptr(this_ptr);
28327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28329         this_ptr_conv.is_owned = false;
28330         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
28331         return ret_conv;
28332 }
28333
28334 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) {
28335         LDKChannelHandshakeConfig this_ptr_conv;
28336         this_ptr_conv.inner = untag_ptr(this_ptr);
28337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28339         this_ptr_conv.is_owned = false;
28340         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
28341 }
28342
28343 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) {
28344         LDKChannelHandshakeConfig this_ptr_conv;
28345         this_ptr_conv.inner = untag_ptr(this_ptr);
28346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28348         this_ptr_conv.is_owned = false;
28349         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
28350         return ret_conv;
28351 }
28352
28353 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) {
28354         LDKChannelHandshakeConfig this_ptr_conv;
28355         this_ptr_conv.inner = untag_ptr(this_ptr);
28356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28358         this_ptr_conv.is_owned = false;
28359         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
28360 }
28361
28362 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
28363         LDKChannelHandshakeConfig this_ptr_conv;
28364         this_ptr_conv.inner = untag_ptr(this_ptr);
28365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28367         this_ptr_conv.is_owned = false;
28368         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
28369         return ret_conv;
28370 }
28371
28372 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
28373         LDKChannelHandshakeConfig this_ptr_conv;
28374         this_ptr_conv.inner = untag_ptr(this_ptr);
28375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28377         this_ptr_conv.is_owned = false;
28378         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
28379 }
28380
28381 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
28382         LDKChannelHandshakeConfig this_ptr_conv;
28383         this_ptr_conv.inner = untag_ptr(this_ptr);
28384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28386         this_ptr_conv.is_owned = false;
28387         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
28388         return ret_conv;
28389 }
28390
28391 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
28392         LDKChannelHandshakeConfig this_ptr_conv;
28393         this_ptr_conv.inner = untag_ptr(this_ptr);
28394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28396         this_ptr_conv.is_owned = false;
28397         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
28398 }
28399
28400 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
28401         LDKChannelHandshakeConfig this_ptr_conv;
28402         this_ptr_conv.inner = untag_ptr(this_ptr);
28403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28405         this_ptr_conv.is_owned = false;
28406         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
28407         return ret_conv;
28408 }
28409
28410 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
28411         LDKChannelHandshakeConfig this_ptr_conv;
28412         this_ptr_conv.inner = untag_ptr(this_ptr);
28413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28415         this_ptr_conv.is_owned = false;
28416         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
28417 }
28418
28419 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) {
28420         LDKChannelHandshakeConfig this_ptr_conv;
28421         this_ptr_conv.inner = untag_ptr(this_ptr);
28422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28424         this_ptr_conv.is_owned = false;
28425         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
28426         return ret_conv;
28427 }
28428
28429 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) {
28430         LDKChannelHandshakeConfig this_ptr_conv;
28431         this_ptr_conv.inner = untag_ptr(this_ptr);
28432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28434         this_ptr_conv.is_owned = false;
28435         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
28436 }
28437
28438 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) {
28439         LDKChannelHandshakeConfig this_ptr_conv;
28440         this_ptr_conv.inner = untag_ptr(this_ptr);
28441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28443         this_ptr_conv.is_owned = false;
28444         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
28445         return ret_conv;
28446 }
28447
28448 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) {
28449         LDKChannelHandshakeConfig this_ptr_conv;
28450         this_ptr_conv.inner = untag_ptr(this_ptr);
28451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28453         this_ptr_conv.is_owned = false;
28454         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
28455 }
28456
28457 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
28458         LDKChannelHandshakeConfig this_ptr_conv;
28459         this_ptr_conv.inner = untag_ptr(this_ptr);
28460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28462         this_ptr_conv.is_owned = false;
28463         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
28464         return ret_conv;
28465 }
28466
28467 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) {
28468         LDKChannelHandshakeConfig this_ptr_conv;
28469         this_ptr_conv.inner = untag_ptr(this_ptr);
28470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28472         this_ptr_conv.is_owned = false;
28473         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
28474 }
28475
28476 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) {
28477         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);
28478         uint64_t ret_ref = 0;
28479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28481         return ret_ref;
28482 }
28483
28484 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
28485         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
28486         uint64_t ret_ref = 0;
28487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28489         return ret_ref;
28490 }
28491 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
28492         LDKChannelHandshakeConfig arg_conv;
28493         arg_conv.inner = untag_ptr(arg);
28494         arg_conv.is_owned = ptr_is_owned(arg);
28495         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28496         arg_conv.is_owned = false;
28497         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
28498         return ret_conv;
28499 }
28500
28501 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
28502         LDKChannelHandshakeConfig orig_conv;
28503         orig_conv.inner = untag_ptr(orig);
28504         orig_conv.is_owned = ptr_is_owned(orig);
28505         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28506         orig_conv.is_owned = false;
28507         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
28508         uint64_t ret_ref = 0;
28509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28511         return ret_ref;
28512 }
28513
28514 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
28515         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
28516         uint64_t ret_ref = 0;
28517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28519         return ret_ref;
28520 }
28521
28522 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
28523         LDKChannelHandshakeLimits this_obj_conv;
28524         this_obj_conv.inner = untag_ptr(this_obj);
28525         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28527         ChannelHandshakeLimits_free(this_obj_conv);
28528 }
28529
28530 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
28531         LDKChannelHandshakeLimits this_ptr_conv;
28532         this_ptr_conv.inner = untag_ptr(this_ptr);
28533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28535         this_ptr_conv.is_owned = false;
28536         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
28537         return ret_conv;
28538 }
28539
28540 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
28541         LDKChannelHandshakeLimits this_ptr_conv;
28542         this_ptr_conv.inner = untag_ptr(this_ptr);
28543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28545         this_ptr_conv.is_owned = false;
28546         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
28547 }
28548
28549 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
28550         LDKChannelHandshakeLimits this_ptr_conv;
28551         this_ptr_conv.inner = untag_ptr(this_ptr);
28552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28554         this_ptr_conv.is_owned = false;
28555         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
28556         return ret_conv;
28557 }
28558
28559 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
28560         LDKChannelHandshakeLimits this_ptr_conv;
28561         this_ptr_conv.inner = untag_ptr(this_ptr);
28562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28564         this_ptr_conv.is_owned = false;
28565         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
28566 }
28567
28568 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
28569         LDKChannelHandshakeLimits this_ptr_conv;
28570         this_ptr_conv.inner = untag_ptr(this_ptr);
28571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28573         this_ptr_conv.is_owned = false;
28574         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
28575         return ret_conv;
28576 }
28577
28578 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) {
28579         LDKChannelHandshakeLimits this_ptr_conv;
28580         this_ptr_conv.inner = untag_ptr(this_ptr);
28581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28583         this_ptr_conv.is_owned = false;
28584         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
28585 }
28586
28587 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) {
28588         LDKChannelHandshakeLimits this_ptr_conv;
28589         this_ptr_conv.inner = untag_ptr(this_ptr);
28590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28592         this_ptr_conv.is_owned = false;
28593         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
28594         return ret_conv;
28595 }
28596
28597 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) {
28598         LDKChannelHandshakeLimits this_ptr_conv;
28599         this_ptr_conv.inner = untag_ptr(this_ptr);
28600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28602         this_ptr_conv.is_owned = false;
28603         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28604 }
28605
28606 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
28607         LDKChannelHandshakeLimits this_ptr_conv;
28608         this_ptr_conv.inner = untag_ptr(this_ptr);
28609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28611         this_ptr_conv.is_owned = false;
28612         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
28613         return ret_conv;
28614 }
28615
28616 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) {
28617         LDKChannelHandshakeLimits this_ptr_conv;
28618         this_ptr_conv.inner = untag_ptr(this_ptr);
28619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28621         this_ptr_conv.is_owned = false;
28622         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
28623 }
28624
28625 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
28626         LDKChannelHandshakeLimits this_ptr_conv;
28627         this_ptr_conv.inner = untag_ptr(this_ptr);
28628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28630         this_ptr_conv.is_owned = false;
28631         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
28632         return ret_conv;
28633 }
28634
28635 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) {
28636         LDKChannelHandshakeLimits this_ptr_conv;
28637         this_ptr_conv.inner = untag_ptr(this_ptr);
28638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28640         this_ptr_conv.is_owned = false;
28641         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
28642 }
28643
28644 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
28645         LDKChannelHandshakeLimits this_ptr_conv;
28646         this_ptr_conv.inner = untag_ptr(this_ptr);
28647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28649         this_ptr_conv.is_owned = false;
28650         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
28651         return ret_conv;
28652 }
28653
28654 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
28655         LDKChannelHandshakeLimits this_ptr_conv;
28656         this_ptr_conv.inner = untag_ptr(this_ptr);
28657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28659         this_ptr_conv.is_owned = false;
28660         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
28661 }
28662
28663 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
28664         LDKChannelHandshakeLimits this_ptr_conv;
28665         this_ptr_conv.inner = untag_ptr(this_ptr);
28666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28668         this_ptr_conv.is_owned = false;
28669         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
28670         return ret_conv;
28671 }
28672
28673 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
28674         LDKChannelHandshakeLimits this_ptr_conv;
28675         this_ptr_conv.inner = untag_ptr(this_ptr);
28676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28678         this_ptr_conv.is_owned = false;
28679         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
28680 }
28681
28682 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
28683         LDKChannelHandshakeLimits this_ptr_conv;
28684         this_ptr_conv.inner = untag_ptr(this_ptr);
28685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28687         this_ptr_conv.is_owned = false;
28688         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
28689         return ret_conv;
28690 }
28691
28692 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
28693         LDKChannelHandshakeLimits this_ptr_conv;
28694         this_ptr_conv.inner = untag_ptr(this_ptr);
28695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28697         this_ptr_conv.is_owned = false;
28698         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
28699 }
28700
28701 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
28702         LDKChannelHandshakeLimits this_ptr_conv;
28703         this_ptr_conv.inner = untag_ptr(this_ptr);
28704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28706         this_ptr_conv.is_owned = false;
28707         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
28708         return ret_conv;
28709 }
28710
28711 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) {
28712         LDKChannelHandshakeLimits this_ptr_conv;
28713         this_ptr_conv.inner = untag_ptr(this_ptr);
28714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28716         this_ptr_conv.is_owned = false;
28717         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
28718 }
28719
28720 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) {
28721         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);
28722         uint64_t ret_ref = 0;
28723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28725         return ret_ref;
28726 }
28727
28728 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
28729         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
28730         uint64_t ret_ref = 0;
28731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28733         return ret_ref;
28734 }
28735 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
28736         LDKChannelHandshakeLimits arg_conv;
28737         arg_conv.inner = untag_ptr(arg);
28738         arg_conv.is_owned = ptr_is_owned(arg);
28739         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28740         arg_conv.is_owned = false;
28741         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
28742         return ret_conv;
28743 }
28744
28745 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
28746         LDKChannelHandshakeLimits orig_conv;
28747         orig_conv.inner = untag_ptr(orig);
28748         orig_conv.is_owned = ptr_is_owned(orig);
28749         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28750         orig_conv.is_owned = false;
28751         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
28752         uint64_t ret_ref = 0;
28753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28755         return ret_ref;
28756 }
28757
28758 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
28759         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
28760         uint64_t ret_ref = 0;
28761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28763         return ret_ref;
28764 }
28765
28766 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
28767         if (!ptr_is_owned(this_ptr)) return;
28768         void* this_ptr_ptr = untag_ptr(this_ptr);
28769         CHECK_ACCESS(this_ptr_ptr);
28770         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
28771         FREE(untag_ptr(this_ptr));
28772         MaxDustHTLCExposure_free(this_ptr_conv);
28773 }
28774
28775 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
28776         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28777         *ret_copy = MaxDustHTLCExposure_clone(arg);
28778         uint64_t ret_ref = tag_ptr(ret_copy, true);
28779         return ret_ref;
28780 }
28781 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
28782         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
28783         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
28784         return ret_conv;
28785 }
28786
28787 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
28788         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
28789         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28790         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
28791         uint64_t ret_ref = tag_ptr(ret_copy, true);
28792         return ret_ref;
28793 }
28794
28795 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
28796         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28797         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
28798         uint64_t ret_ref = tag_ptr(ret_copy, true);
28799         return ret_ref;
28800 }
28801
28802 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
28803         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28804         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
28805         uint64_t ret_ref = tag_ptr(ret_copy, true);
28806         return ret_ref;
28807 }
28808
28809 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
28810         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
28811         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
28812         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
28813         return ret_conv;
28814 }
28815
28816 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
28817         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
28818         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
28819         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28820         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28821         CVec_u8Z_free(ret_var);
28822         return ret_arr;
28823 }
28824
28825 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
28826         LDKu8slice ser_ref;
28827         ser_ref.datalen = ser->arr_len;
28828         ser_ref.data = ser->elems;
28829         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28830         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
28831         FREE(ser);
28832         return tag_ptr(ret_conv, true);
28833 }
28834
28835 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
28836         LDKChannelConfig this_obj_conv;
28837         this_obj_conv.inner = untag_ptr(this_obj);
28838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28840         ChannelConfig_free(this_obj_conv);
28841 }
28842
28843 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
28844         LDKChannelConfig this_ptr_conv;
28845         this_ptr_conv.inner = untag_ptr(this_ptr);
28846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28848         this_ptr_conv.is_owned = false;
28849         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
28850         return ret_conv;
28851 }
28852
28853 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) {
28854         LDKChannelConfig this_ptr_conv;
28855         this_ptr_conv.inner = untag_ptr(this_ptr);
28856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28858         this_ptr_conv.is_owned = false;
28859         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
28860 }
28861
28862 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
28863         LDKChannelConfig this_ptr_conv;
28864         this_ptr_conv.inner = untag_ptr(this_ptr);
28865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28867         this_ptr_conv.is_owned = false;
28868         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
28869         return ret_conv;
28870 }
28871
28872 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) {
28873         LDKChannelConfig this_ptr_conv;
28874         this_ptr_conv.inner = untag_ptr(this_ptr);
28875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28877         this_ptr_conv.is_owned = false;
28878         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
28879 }
28880
28881 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
28882         LDKChannelConfig this_ptr_conv;
28883         this_ptr_conv.inner = untag_ptr(this_ptr);
28884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28886         this_ptr_conv.is_owned = false;
28887         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
28888         return ret_conv;
28889 }
28890
28891 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
28892         LDKChannelConfig this_ptr_conv;
28893         this_ptr_conv.inner = untag_ptr(this_ptr);
28894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28896         this_ptr_conv.is_owned = false;
28897         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
28898 }
28899
28900 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
28901         LDKChannelConfig this_ptr_conv;
28902         this_ptr_conv.inner = untag_ptr(this_ptr);
28903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28905         this_ptr_conv.is_owned = false;
28906         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28907         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
28908         uint64_t ret_ref = tag_ptr(ret_copy, true);
28909         return ret_ref;
28910 }
28911
28912 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) {
28913         LDKChannelConfig this_ptr_conv;
28914         this_ptr_conv.inner = untag_ptr(this_ptr);
28915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28917         this_ptr_conv.is_owned = false;
28918         void* val_ptr = untag_ptr(val);
28919         CHECK_ACCESS(val_ptr);
28920         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
28921         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
28922         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
28923 }
28924
28925 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) {
28926         LDKChannelConfig this_ptr_conv;
28927         this_ptr_conv.inner = untag_ptr(this_ptr);
28928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28930         this_ptr_conv.is_owned = false;
28931         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
28932         return ret_conv;
28933 }
28934
28935 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) {
28936         LDKChannelConfig this_ptr_conv;
28937         this_ptr_conv.inner = untag_ptr(this_ptr);
28938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28940         this_ptr_conv.is_owned = false;
28941         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
28942 }
28943
28944 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
28945         LDKChannelConfig this_ptr_conv;
28946         this_ptr_conv.inner = untag_ptr(this_ptr);
28947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28949         this_ptr_conv.is_owned = false;
28950         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
28951         return ret_conv;
28952 }
28953
28954 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
28955         LDKChannelConfig this_ptr_conv;
28956         this_ptr_conv.inner = untag_ptr(this_ptr);
28957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28959         this_ptr_conv.is_owned = false;
28960         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
28961 }
28962
28963 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) {
28964         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
28965         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
28966         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
28967         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
28968         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);
28969         uint64_t ret_ref = 0;
28970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28972         return ret_ref;
28973 }
28974
28975 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
28976         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
28977         uint64_t ret_ref = 0;
28978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28980         return ret_ref;
28981 }
28982 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
28983         LDKChannelConfig arg_conv;
28984         arg_conv.inner = untag_ptr(arg);
28985         arg_conv.is_owned = ptr_is_owned(arg);
28986         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28987         arg_conv.is_owned = false;
28988         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
28989         return ret_conv;
28990 }
28991
28992 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
28993         LDKChannelConfig orig_conv;
28994         orig_conv.inner = untag_ptr(orig);
28995         orig_conv.is_owned = ptr_is_owned(orig);
28996         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28997         orig_conv.is_owned = false;
28998         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
28999         uint64_t ret_ref = 0;
29000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29002         return ret_ref;
29003 }
29004
29005 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
29006         LDKChannelConfig a_conv;
29007         a_conv.inner = untag_ptr(a);
29008         a_conv.is_owned = ptr_is_owned(a);
29009         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29010         a_conv.is_owned = false;
29011         LDKChannelConfig b_conv;
29012         b_conv.inner = untag_ptr(b);
29013         b_conv.is_owned = ptr_is_owned(b);
29014         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29015         b_conv.is_owned = false;
29016         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
29017         return ret_conv;
29018 }
29019
29020 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
29021         LDKChannelConfig this_arg_conv;
29022         this_arg_conv.inner = untag_ptr(this_arg);
29023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29025         this_arg_conv.is_owned = false;
29026         LDKChannelConfigUpdate update_conv;
29027         update_conv.inner = untag_ptr(update);
29028         update_conv.is_owned = ptr_is_owned(update);
29029         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
29030         update_conv.is_owned = false;
29031         ChannelConfig_apply(&this_arg_conv, &update_conv);
29032 }
29033
29034 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
29035         LDKChannelConfig ret_var = ChannelConfig_default();
29036         uint64_t ret_ref = 0;
29037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29039         return ret_ref;
29040 }
29041
29042 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
29043         LDKChannelConfig obj_conv;
29044         obj_conv.inner = untag_ptr(obj);
29045         obj_conv.is_owned = ptr_is_owned(obj);
29046         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29047         obj_conv.is_owned = false;
29048         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
29049         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29050         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29051         CVec_u8Z_free(ret_var);
29052         return ret_arr;
29053 }
29054
29055 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
29056         LDKu8slice ser_ref;
29057         ser_ref.datalen = ser->arr_len;
29058         ser_ref.data = ser->elems;
29059         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
29060         *ret_conv = ChannelConfig_read(ser_ref);
29061         FREE(ser);
29062         return tag_ptr(ret_conv, true);
29063 }
29064
29065 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
29066         LDKChannelConfigUpdate this_obj_conv;
29067         this_obj_conv.inner = untag_ptr(this_obj);
29068         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29070         ChannelConfigUpdate_free(this_obj_conv);
29071 }
29072
29073 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
29074         LDKChannelConfigUpdate this_ptr_conv;
29075         this_ptr_conv.inner = untag_ptr(this_ptr);
29076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29078         this_ptr_conv.is_owned = false;
29079         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29080         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
29081         uint64_t ret_ref = tag_ptr(ret_copy, true);
29082         return ret_ref;
29083 }
29084
29085 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) {
29086         LDKChannelConfigUpdate this_ptr_conv;
29087         this_ptr_conv.inner = untag_ptr(this_ptr);
29088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29090         this_ptr_conv.is_owned = false;
29091         void* val_ptr = untag_ptr(val);
29092         CHECK_ACCESS(val_ptr);
29093         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29094         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
29095         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
29096 }
29097
29098 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
29099         LDKChannelConfigUpdate this_ptr_conv;
29100         this_ptr_conv.inner = untag_ptr(this_ptr);
29101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29103         this_ptr_conv.is_owned = false;
29104         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29105         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
29106         uint64_t ret_ref = tag_ptr(ret_copy, true);
29107         return ret_ref;
29108 }
29109
29110 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) {
29111         LDKChannelConfigUpdate this_ptr_conv;
29112         this_ptr_conv.inner = untag_ptr(this_ptr);
29113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29115         this_ptr_conv.is_owned = false;
29116         void* val_ptr = untag_ptr(val);
29117         CHECK_ACCESS(val_ptr);
29118         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29119         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
29120         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
29121 }
29122
29123 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
29124         LDKChannelConfigUpdate this_ptr_conv;
29125         this_ptr_conv.inner = untag_ptr(this_ptr);
29126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29128         this_ptr_conv.is_owned = false;
29129         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
29130         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
29131         uint64_t ret_ref = tag_ptr(ret_copy, true);
29132         return ret_ref;
29133 }
29134
29135 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
29136         LDKChannelConfigUpdate this_ptr_conv;
29137         this_ptr_conv.inner = untag_ptr(this_ptr);
29138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29140         this_ptr_conv.is_owned = false;
29141         void* val_ptr = untag_ptr(val);
29142         CHECK_ACCESS(val_ptr);
29143         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
29144         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
29145         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
29146 }
29147
29148 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) {
29149         LDKChannelConfigUpdate this_ptr_conv;
29150         this_ptr_conv.inner = untag_ptr(this_ptr);
29151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29153         this_ptr_conv.is_owned = false;
29154         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
29155         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
29156         uint64_t ret_ref = tag_ptr(ret_copy, true);
29157         return ret_ref;
29158 }
29159
29160 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) {
29161         LDKChannelConfigUpdate this_ptr_conv;
29162         this_ptr_conv.inner = untag_ptr(this_ptr);
29163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29165         this_ptr_conv.is_owned = false;
29166         void* val_ptr = untag_ptr(val);
29167         CHECK_ACCESS(val_ptr);
29168         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
29169         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
29170         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
29171 }
29172
29173 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) {
29174         LDKChannelConfigUpdate this_ptr_conv;
29175         this_ptr_conv.inner = untag_ptr(this_ptr);
29176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29178         this_ptr_conv.is_owned = false;
29179         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29180         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
29181         uint64_t ret_ref = tag_ptr(ret_copy, true);
29182         return ret_ref;
29183 }
29184
29185 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) {
29186         LDKChannelConfigUpdate this_ptr_conv;
29187         this_ptr_conv.inner = untag_ptr(this_ptr);
29188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29190         this_ptr_conv.is_owned = false;
29191         void* val_ptr = untag_ptr(val);
29192         CHECK_ACCESS(val_ptr);
29193         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29194         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
29195         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
29196 }
29197
29198 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) {
29199         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
29200         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
29201         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
29202         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
29203         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
29204         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
29205         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
29206         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
29207         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
29208         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
29209         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
29210         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
29211         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
29212         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
29213         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
29214         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
29215         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
29216         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
29217         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
29218         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
29219         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);
29220         uint64_t ret_ref = 0;
29221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29223         return ret_ref;
29224 }
29225
29226 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
29227         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
29228         uint64_t ret_ref = 0;
29229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29231         return ret_ref;
29232 }
29233
29234 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
29235         LDKUserConfig this_obj_conv;
29236         this_obj_conv.inner = untag_ptr(this_obj);
29237         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29239         UserConfig_free(this_obj_conv);
29240 }
29241
29242 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
29243         LDKUserConfig this_ptr_conv;
29244         this_ptr_conv.inner = untag_ptr(this_ptr);
29245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29247         this_ptr_conv.is_owned = false;
29248         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
29249         uint64_t ret_ref = 0;
29250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29252         return ret_ref;
29253 }
29254
29255 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
29256         LDKUserConfig this_ptr_conv;
29257         this_ptr_conv.inner = untag_ptr(this_ptr);
29258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29260         this_ptr_conv.is_owned = false;
29261         LDKChannelHandshakeConfig val_conv;
29262         val_conv.inner = untag_ptr(val);
29263         val_conv.is_owned = ptr_is_owned(val);
29264         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29265         val_conv = ChannelHandshakeConfig_clone(&val_conv);
29266         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
29267 }
29268
29269 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
29270         LDKUserConfig this_ptr_conv;
29271         this_ptr_conv.inner = untag_ptr(this_ptr);
29272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29274         this_ptr_conv.is_owned = false;
29275         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
29276         uint64_t ret_ref = 0;
29277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29279         return ret_ref;
29280 }
29281
29282 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
29283         LDKUserConfig this_ptr_conv;
29284         this_ptr_conv.inner = untag_ptr(this_ptr);
29285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29287         this_ptr_conv.is_owned = false;
29288         LDKChannelHandshakeLimits val_conv;
29289         val_conv.inner = untag_ptr(val);
29290         val_conv.is_owned = ptr_is_owned(val);
29291         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29292         val_conv = ChannelHandshakeLimits_clone(&val_conv);
29293         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
29294 }
29295
29296 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
29297         LDKUserConfig this_ptr_conv;
29298         this_ptr_conv.inner = untag_ptr(this_ptr);
29299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29301         this_ptr_conv.is_owned = false;
29302         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
29303         uint64_t ret_ref = 0;
29304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29306         return ret_ref;
29307 }
29308
29309 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
29310         LDKUserConfig this_ptr_conv;
29311         this_ptr_conv.inner = untag_ptr(this_ptr);
29312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29314         this_ptr_conv.is_owned = false;
29315         LDKChannelConfig val_conv;
29316         val_conv.inner = untag_ptr(val);
29317         val_conv.is_owned = ptr_is_owned(val);
29318         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29319         val_conv = ChannelConfig_clone(&val_conv);
29320         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
29321 }
29322
29323 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
29324         LDKUserConfig this_ptr_conv;
29325         this_ptr_conv.inner = untag_ptr(this_ptr);
29326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29328         this_ptr_conv.is_owned = false;
29329         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
29330         return ret_conv;
29331 }
29332
29333 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) {
29334         LDKUserConfig this_ptr_conv;
29335         this_ptr_conv.inner = untag_ptr(this_ptr);
29336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29338         this_ptr_conv.is_owned = false;
29339         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
29340 }
29341
29342 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
29343         LDKUserConfig this_ptr_conv;
29344         this_ptr_conv.inner = untag_ptr(this_ptr);
29345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29347         this_ptr_conv.is_owned = false;
29348         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
29349         return ret_conv;
29350 }
29351
29352 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
29353         LDKUserConfig this_ptr_conv;
29354         this_ptr_conv.inner = untag_ptr(this_ptr);
29355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29357         this_ptr_conv.is_owned = false;
29358         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
29359 }
29360
29361 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
29362         LDKUserConfig this_ptr_conv;
29363         this_ptr_conv.inner = untag_ptr(this_ptr);
29364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29366         this_ptr_conv.is_owned = false;
29367         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
29368         return ret_conv;
29369 }
29370
29371 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
29372         LDKUserConfig this_ptr_conv;
29373         this_ptr_conv.inner = untag_ptr(this_ptr);
29374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29376         this_ptr_conv.is_owned = false;
29377         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
29378 }
29379
29380 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
29381         LDKUserConfig this_ptr_conv;
29382         this_ptr_conv.inner = untag_ptr(this_ptr);
29383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29385         this_ptr_conv.is_owned = false;
29386         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
29387         return ret_conv;
29388 }
29389
29390 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
29391         LDKUserConfig this_ptr_conv;
29392         this_ptr_conv.inner = untag_ptr(this_ptr);
29393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29395         this_ptr_conv.is_owned = false;
29396         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
29397 }
29398
29399 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
29400         LDKUserConfig this_ptr_conv;
29401         this_ptr_conv.inner = untag_ptr(this_ptr);
29402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29404         this_ptr_conv.is_owned = false;
29405         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
29406         return ret_conv;
29407 }
29408
29409 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
29410         LDKUserConfig this_ptr_conv;
29411         this_ptr_conv.inner = untag_ptr(this_ptr);
29412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29414         this_ptr_conv.is_owned = false;
29415         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
29416 }
29417
29418 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) {
29419         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
29420         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
29421         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
29422         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
29423         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
29424         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
29425         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
29426         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
29427         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
29428         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
29429         LDKChannelConfig channel_config_arg_conv;
29430         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
29431         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
29432         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
29433         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
29434         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);
29435         uint64_t ret_ref = 0;
29436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29438         return ret_ref;
29439 }
29440
29441 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
29442         LDKUserConfig ret_var = UserConfig_clone(arg);
29443         uint64_t ret_ref = 0;
29444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29446         return ret_ref;
29447 }
29448 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
29449         LDKUserConfig arg_conv;
29450         arg_conv.inner = untag_ptr(arg);
29451         arg_conv.is_owned = ptr_is_owned(arg);
29452         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29453         arg_conv.is_owned = false;
29454         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
29455         return ret_conv;
29456 }
29457
29458 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
29459         LDKUserConfig orig_conv;
29460         orig_conv.inner = untag_ptr(orig);
29461         orig_conv.is_owned = ptr_is_owned(orig);
29462         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29463         orig_conv.is_owned = false;
29464         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
29465         uint64_t ret_ref = 0;
29466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29468         return ret_ref;
29469 }
29470
29471 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
29472         LDKUserConfig ret_var = UserConfig_default();
29473         uint64_t ret_ref = 0;
29474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29476         return ret_ref;
29477 }
29478
29479 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
29480         LDKBestBlock this_obj_conv;
29481         this_obj_conv.inner = untag_ptr(this_obj);
29482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29484         BestBlock_free(this_obj_conv);
29485 }
29486
29487 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
29488         LDKBestBlock ret_var = BestBlock_clone(arg);
29489         uint64_t ret_ref = 0;
29490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29492         return ret_ref;
29493 }
29494 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
29495         LDKBestBlock arg_conv;
29496         arg_conv.inner = untag_ptr(arg);
29497         arg_conv.is_owned = ptr_is_owned(arg);
29498         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29499         arg_conv.is_owned = false;
29500         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
29501         return ret_conv;
29502 }
29503
29504 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
29505         LDKBestBlock orig_conv;
29506         orig_conv.inner = untag_ptr(orig);
29507         orig_conv.is_owned = ptr_is_owned(orig);
29508         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29509         orig_conv.is_owned = false;
29510         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
29511         uint64_t ret_ref = 0;
29512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29514         return ret_ref;
29515 }
29516
29517 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
29518         LDKBestBlock a_conv;
29519         a_conv.inner = untag_ptr(a);
29520         a_conv.is_owned = ptr_is_owned(a);
29521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29522         a_conv.is_owned = false;
29523         LDKBestBlock b_conv;
29524         b_conv.inner = untag_ptr(b);
29525         b_conv.is_owned = ptr_is_owned(b);
29526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29527         b_conv.is_owned = false;
29528         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
29529         return ret_conv;
29530 }
29531
29532 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
29533         LDKNetwork network_conv = LDKNetwork_from_js(network);
29534         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
29535         uint64_t ret_ref = 0;
29536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29538         return ret_ref;
29539 }
29540
29541 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
29542         LDKThirtyTwoBytes block_hash_ref;
29543         CHECK(block_hash->arr_len == 32);
29544         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
29545         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
29546         uint64_t ret_ref = 0;
29547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29549         return ret_ref;
29550 }
29551
29552 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
29553         LDKBestBlock this_arg_conv;
29554         this_arg_conv.inner = untag_ptr(this_arg);
29555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29557         this_arg_conv.is_owned = false;
29558         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29559         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
29560         return ret_arr;
29561 }
29562
29563 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
29564         LDKBestBlock this_arg_conv;
29565         this_arg_conv.inner = untag_ptr(this_arg);
29566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29568         this_arg_conv.is_owned = false;
29569         int32_t ret_conv = BestBlock_height(&this_arg_conv);
29570         return ret_conv;
29571 }
29572
29573 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
29574         if (!ptr_is_owned(this_ptr)) return;
29575         void* this_ptr_ptr = untag_ptr(this_ptr);
29576         CHECK_ACCESS(this_ptr_ptr);
29577         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
29578         FREE(untag_ptr(this_ptr));
29579         Listen_free(this_ptr_conv);
29580 }
29581
29582 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
29583         if (!ptr_is_owned(this_ptr)) return;
29584         void* this_ptr_ptr = untag_ptr(this_ptr);
29585         CHECK_ACCESS(this_ptr_ptr);
29586         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
29587         FREE(untag_ptr(this_ptr));
29588         Confirm_free(this_ptr_conv);
29589 }
29590
29591 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
29592         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
29593         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
29594         return ret_conv;
29595 }
29596
29597 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
29598         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
29599         return ret_conv;
29600 }
29601
29602 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
29603         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
29604         return ret_conv;
29605 }
29606
29607 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
29608         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
29609         return ret_conv;
29610 }
29611
29612 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
29613         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
29614         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
29615         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
29616         return ret_conv;
29617 }
29618
29619 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
29620         if (!ptr_is_owned(this_ptr)) return;
29621         void* this_ptr_ptr = untag_ptr(this_ptr);
29622         CHECK_ACCESS(this_ptr_ptr);
29623         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
29624         FREE(untag_ptr(this_ptr));
29625         Watch_free(this_ptr_conv);
29626 }
29627
29628 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
29629         if (!ptr_is_owned(this_ptr)) return;
29630         void* this_ptr_ptr = untag_ptr(this_ptr);
29631         CHECK_ACCESS(this_ptr_ptr);
29632         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
29633         FREE(untag_ptr(this_ptr));
29634         Filter_free(this_ptr_conv);
29635 }
29636
29637 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
29638         LDKWatchedOutput this_obj_conv;
29639         this_obj_conv.inner = untag_ptr(this_obj);
29640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29642         WatchedOutput_free(this_obj_conv);
29643 }
29644
29645 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
29646         LDKWatchedOutput this_ptr_conv;
29647         this_ptr_conv.inner = untag_ptr(this_ptr);
29648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29650         this_ptr_conv.is_owned = false;
29651         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
29652         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
29653         uint64_t ret_ref = tag_ptr(ret_copy, true);
29654         return ret_ref;
29655 }
29656
29657 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
29658         LDKWatchedOutput this_ptr_conv;
29659         this_ptr_conv.inner = untag_ptr(this_ptr);
29660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29662         this_ptr_conv.is_owned = false;
29663         void* val_ptr = untag_ptr(val);
29664         CHECK_ACCESS(val_ptr);
29665         LDKCOption_BlockHashZ val_conv = *(LDKCOption_BlockHashZ*)(val_ptr);
29666         val_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(val));
29667         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
29668 }
29669
29670 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
29671         LDKWatchedOutput this_ptr_conv;
29672         this_ptr_conv.inner = untag_ptr(this_ptr);
29673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29675         this_ptr_conv.is_owned = false;
29676         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
29677         uint64_t ret_ref = 0;
29678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29680         return ret_ref;
29681 }
29682
29683 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
29684         LDKWatchedOutput this_ptr_conv;
29685         this_ptr_conv.inner = untag_ptr(this_ptr);
29686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29688         this_ptr_conv.is_owned = false;
29689         LDKOutPoint val_conv;
29690         val_conv.inner = untag_ptr(val);
29691         val_conv.is_owned = ptr_is_owned(val);
29692         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29693         val_conv = OutPoint_clone(&val_conv);
29694         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
29695 }
29696
29697 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
29698         LDKWatchedOutput this_ptr_conv;
29699         this_ptr_conv.inner = untag_ptr(this_ptr);
29700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29702         this_ptr_conv.is_owned = false;
29703         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
29704         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29705         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29706         return ret_arr;
29707 }
29708
29709 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
29710         LDKWatchedOutput this_ptr_conv;
29711         this_ptr_conv.inner = untag_ptr(this_ptr);
29712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29714         this_ptr_conv.is_owned = false;
29715         LDKCVec_u8Z val_ref;
29716         val_ref.datalen = val->arr_len;
29717         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
29718         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
29719         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
29720 }
29721
29722 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) {
29723         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
29724         CHECK_ACCESS(block_hash_arg_ptr);
29725         LDKCOption_BlockHashZ block_hash_arg_conv = *(LDKCOption_BlockHashZ*)(block_hash_arg_ptr);
29726         block_hash_arg_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(block_hash_arg));
29727         LDKOutPoint outpoint_arg_conv;
29728         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
29729         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
29730         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
29731         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
29732         LDKCVec_u8Z script_pubkey_arg_ref;
29733         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
29734         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
29735         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
29736         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
29737         uint64_t ret_ref = 0;
29738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29740         return ret_ref;
29741 }
29742
29743 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
29744         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
29745         uint64_t ret_ref = 0;
29746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29748         return ret_ref;
29749 }
29750 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
29751         LDKWatchedOutput arg_conv;
29752         arg_conv.inner = untag_ptr(arg);
29753         arg_conv.is_owned = ptr_is_owned(arg);
29754         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29755         arg_conv.is_owned = false;
29756         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
29757         return ret_conv;
29758 }
29759
29760 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
29761         LDKWatchedOutput orig_conv;
29762         orig_conv.inner = untag_ptr(orig);
29763         orig_conv.is_owned = ptr_is_owned(orig);
29764         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29765         orig_conv.is_owned = false;
29766         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
29767         uint64_t ret_ref = 0;
29768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29770         return ret_ref;
29771 }
29772
29773 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
29774         LDKWatchedOutput a_conv;
29775         a_conv.inner = untag_ptr(a);
29776         a_conv.is_owned = ptr_is_owned(a);
29777         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29778         a_conv.is_owned = false;
29779         LDKWatchedOutput b_conv;
29780         b_conv.inner = untag_ptr(b);
29781         b_conv.is_owned = ptr_is_owned(b);
29782         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29783         b_conv.is_owned = false;
29784         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
29785         return ret_conv;
29786 }
29787
29788 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
29789         LDKWatchedOutput o_conv;
29790         o_conv.inner = untag_ptr(o);
29791         o_conv.is_owned = ptr_is_owned(o);
29792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29793         o_conv.is_owned = false;
29794         int64_t ret_conv = WatchedOutput_hash(&o_conv);
29795         return ret_conv;
29796 }
29797
29798 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
29799         if (!ptr_is_owned(this_ptr)) return;
29800         void* this_ptr_ptr = untag_ptr(this_ptr);
29801         CHECK_ACCESS(this_ptr_ptr);
29802         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
29803         FREE(untag_ptr(this_ptr));
29804         BroadcasterInterface_free(this_ptr_conv);
29805 }
29806
29807 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
29808         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
29809         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
29810         return ret_conv;
29811 }
29812
29813 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_mempool_minimum"))) TS_ConfirmationTarget_mempool_minimum() {
29814         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_mempool_minimum());
29815         return ret_conv;
29816 }
29817
29818 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
29819         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
29820         return ret_conv;
29821 }
29822
29823 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
29824         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
29825         return ret_conv;
29826 }
29827
29828 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
29829         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
29830         return ret_conv;
29831 }
29832
29833 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
29834         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
29835         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
29836         return ret_conv;
29837 }
29838
29839 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
29840         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
29841         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
29842         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
29843         return ret_conv;
29844 }
29845
29846 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
29847         if (!ptr_is_owned(this_ptr)) return;
29848         void* this_ptr_ptr = untag_ptr(this_ptr);
29849         CHECK_ACCESS(this_ptr_ptr);
29850         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
29851         FREE(untag_ptr(this_ptr));
29852         FeeEstimator_free(this_ptr_conv);
29853 }
29854
29855 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
29856         LDKMonitorUpdateId this_obj_conv;
29857         this_obj_conv.inner = untag_ptr(this_obj);
29858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29860         MonitorUpdateId_free(this_obj_conv);
29861 }
29862
29863 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
29864         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
29865         uint64_t ret_ref = 0;
29866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29868         return ret_ref;
29869 }
29870 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
29871         LDKMonitorUpdateId arg_conv;
29872         arg_conv.inner = untag_ptr(arg);
29873         arg_conv.is_owned = ptr_is_owned(arg);
29874         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29875         arg_conv.is_owned = false;
29876         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
29877         return ret_conv;
29878 }
29879
29880 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
29881         LDKMonitorUpdateId orig_conv;
29882         orig_conv.inner = untag_ptr(orig);
29883         orig_conv.is_owned = ptr_is_owned(orig);
29884         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29885         orig_conv.is_owned = false;
29886         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
29887         uint64_t ret_ref = 0;
29888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29890         return ret_ref;
29891 }
29892
29893 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
29894         LDKMonitorUpdateId o_conv;
29895         o_conv.inner = untag_ptr(o);
29896         o_conv.is_owned = ptr_is_owned(o);
29897         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29898         o_conv.is_owned = false;
29899         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
29900         return ret_conv;
29901 }
29902
29903 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
29904         LDKMonitorUpdateId a_conv;
29905         a_conv.inner = untag_ptr(a);
29906         a_conv.is_owned = ptr_is_owned(a);
29907         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29908         a_conv.is_owned = false;
29909         LDKMonitorUpdateId b_conv;
29910         b_conv.inner = untag_ptr(b);
29911         b_conv.is_owned = ptr_is_owned(b);
29912         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29913         b_conv.is_owned = false;
29914         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
29915         return ret_conv;
29916 }
29917
29918 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
29919         if (!ptr_is_owned(this_ptr)) return;
29920         void* this_ptr_ptr = untag_ptr(this_ptr);
29921         CHECK_ACCESS(this_ptr_ptr);
29922         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
29923         FREE(untag_ptr(this_ptr));
29924         Persist_free(this_ptr_conv);
29925 }
29926
29927 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
29928         LDKLockedChannelMonitor this_obj_conv;
29929         this_obj_conv.inner = untag_ptr(this_obj);
29930         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29932         LockedChannelMonitor_free(this_obj_conv);
29933 }
29934
29935 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
29936         LDKChainMonitor this_obj_conv;
29937         this_obj_conv.inner = untag_ptr(this_obj);
29938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29940         ChainMonitor_free(this_obj_conv);
29941 }
29942
29943 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) {
29944         void* chain_source_ptr = untag_ptr(chain_source);
29945         CHECK_ACCESS(chain_source_ptr);
29946         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
29947         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
29948         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
29949                 // Manually implement clone for Java trait instances
29950                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
29951                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29952                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
29953                 }
29954         }
29955         void* broadcaster_ptr = untag_ptr(broadcaster);
29956         CHECK_ACCESS(broadcaster_ptr);
29957         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
29958         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29959                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29960                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
29961         }
29962         void* logger_ptr = untag_ptr(logger);
29963         CHECK_ACCESS(logger_ptr);
29964         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29965         if (logger_conv.free == LDKLogger_JCalls_free) {
29966                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29967                 LDKLogger_JCalls_cloned(&logger_conv);
29968         }
29969         void* feeest_ptr = untag_ptr(feeest);
29970         CHECK_ACCESS(feeest_ptr);
29971         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
29972         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
29973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29974                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
29975         }
29976         void* persister_ptr = untag_ptr(persister);
29977         CHECK_ACCESS(persister_ptr);
29978         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
29979         if (persister_conv.free == LDKPersist_JCalls_free) {
29980                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29981                 LDKPersist_JCalls_cloned(&persister_conv);
29982         }
29983         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
29984         uint64_t ret_ref = 0;
29985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29987         return ret_ref;
29988 }
29989
29990 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
29991         LDKChainMonitor this_arg_conv;
29992         this_arg_conv.inner = untag_ptr(this_arg);
29993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29995         this_arg_conv.is_owned = false;
29996         LDKCVec_ChannelDetailsZ ignored_channels_constr;
29997         ignored_channels_constr.datalen = ignored_channels->arr_len;
29998         if (ignored_channels_constr.datalen > 0)
29999                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
30000         else
30001                 ignored_channels_constr.data = NULL;
30002         uint64_t* ignored_channels_vals = ignored_channels->elems;
30003         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
30004                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
30005                 LDKChannelDetails ignored_channels_conv_16_conv;
30006                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
30007                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
30008                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
30009                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
30010                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
30011         }
30012         FREE(ignored_channels);
30013         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
30014         uint64_tArray ret_arr = NULL;
30015         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30016         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30017         for (size_t j = 0; j < ret_var.datalen; j++) {
30018                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30019                 *ret_conv_9_copy = ret_var.data[j];
30020                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
30021                 ret_arr_ptr[j] = ret_conv_9_ref;
30022         }
30023         
30024         FREE(ret_var.data);
30025         return ret_arr;
30026 }
30027
30028 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
30029         LDKChainMonitor this_arg_conv;
30030         this_arg_conv.inner = untag_ptr(this_arg);
30031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30033         this_arg_conv.is_owned = false;
30034         LDKOutPoint funding_txo_conv;
30035         funding_txo_conv.inner = untag_ptr(funding_txo);
30036         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
30037         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
30038         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
30039         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
30040         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
30041         return tag_ptr(ret_conv, true);
30042 }
30043
30044 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
30045         LDKChainMonitor this_arg_conv;
30046         this_arg_conv.inner = untag_ptr(this_arg);
30047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30049         this_arg_conv.is_owned = false;
30050         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
30051         uint64_tArray ret_arr = NULL;
30052         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30053         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30054         for (size_t k = 0; k < ret_var.datalen; k++) {
30055                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
30056                 uint64_t ret_conv_10_ref = 0;
30057                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
30058                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
30059                 ret_arr_ptr[k] = ret_conv_10_ref;
30060         }
30061         
30062         FREE(ret_var.data);
30063         return ret_arr;
30064 }
30065
30066 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
30067         LDKChainMonitor this_arg_conv;
30068         this_arg_conv.inner = untag_ptr(this_arg);
30069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30071         this_arg_conv.is_owned = false;
30072         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
30073         uint64_tArray ret_arr = NULL;
30074         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30075         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30076         for (size_t p = 0; p < ret_var.datalen; p++) {
30077                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
30078                 *ret_conv_41_conv = ret_var.data[p];
30079                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
30080         }
30081         
30082         FREE(ret_var.data);
30083         return ret_arr;
30084 }
30085
30086 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) {
30087         LDKChainMonitor this_arg_conv;
30088         this_arg_conv.inner = untag_ptr(this_arg);
30089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30091         this_arg_conv.is_owned = false;
30092         LDKOutPoint funding_txo_conv;
30093         funding_txo_conv.inner = untag_ptr(funding_txo);
30094         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
30095         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
30096         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
30097         LDKMonitorUpdateId completed_update_id_conv;
30098         completed_update_id_conv.inner = untag_ptr(completed_update_id);
30099         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
30100         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
30101         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
30102         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30103         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
30104         return tag_ptr(ret_conv, true);
30105 }
30106
30107 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
30108         LDKChainMonitor this_arg_conv;
30109         this_arg_conv.inner = untag_ptr(this_arg);
30110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30112         this_arg_conv.is_owned = false;
30113         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
30114         uint64_t ret_ref = 0;
30115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30117         return ret_ref;
30118 }
30119
30120 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
30121         LDKChainMonitor this_arg_conv;
30122         this_arg_conv.inner = untag_ptr(this_arg);
30123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30125         this_arg_conv.is_owned = false;
30126         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
30127 }
30128
30129 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
30130         LDKChainMonitor this_arg_conv;
30131         this_arg_conv.inner = untag_ptr(this_arg);
30132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30134         this_arg_conv.is_owned = false;
30135         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
30136         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
30137         return tag_ptr(ret_ret, true);
30138 }
30139
30140 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
30141         LDKChainMonitor this_arg_conv;
30142         this_arg_conv.inner = untag_ptr(this_arg);
30143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30145         this_arg_conv.is_owned = false;
30146         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
30147         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
30148         return tag_ptr(ret_ret, true);
30149 }
30150
30151 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
30152         LDKChainMonitor this_arg_conv;
30153         this_arg_conv.inner = untag_ptr(this_arg);
30154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30156         this_arg_conv.is_owned = false;
30157         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
30158         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
30159         return tag_ptr(ret_ret, true);
30160 }
30161
30162 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
30163         LDKChainMonitor this_arg_conv;
30164         this_arg_conv.inner = untag_ptr(this_arg);
30165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30167         this_arg_conv.is_owned = false;
30168         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
30169         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
30170         return tag_ptr(ret_ret, true);
30171 }
30172
30173 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
30174         LDKChannelMonitorUpdate this_obj_conv;
30175         this_obj_conv.inner = untag_ptr(this_obj);
30176         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30178         ChannelMonitorUpdate_free(this_obj_conv);
30179 }
30180
30181 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
30182         LDKChannelMonitorUpdate this_ptr_conv;
30183         this_ptr_conv.inner = untag_ptr(this_ptr);
30184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30186         this_ptr_conv.is_owned = false;
30187         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
30188         return ret_conv;
30189 }
30190
30191 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
30192         LDKChannelMonitorUpdate this_ptr_conv;
30193         this_ptr_conv.inner = untag_ptr(this_ptr);
30194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30196         this_ptr_conv.is_owned = false;
30197         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
30198 }
30199
30200 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
30201         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
30202         uint64_t ret_ref = 0;
30203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30205         return ret_ref;
30206 }
30207 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
30208         LDKChannelMonitorUpdate arg_conv;
30209         arg_conv.inner = untag_ptr(arg);
30210         arg_conv.is_owned = ptr_is_owned(arg);
30211         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30212         arg_conv.is_owned = false;
30213         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
30214         return ret_conv;
30215 }
30216
30217 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
30218         LDKChannelMonitorUpdate orig_conv;
30219         orig_conv.inner = untag_ptr(orig);
30220         orig_conv.is_owned = ptr_is_owned(orig);
30221         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30222         orig_conv.is_owned = false;
30223         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
30224         uint64_t ret_ref = 0;
30225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30227         return ret_ref;
30228 }
30229
30230 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
30231         LDKChannelMonitorUpdate a_conv;
30232         a_conv.inner = untag_ptr(a);
30233         a_conv.is_owned = ptr_is_owned(a);
30234         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30235         a_conv.is_owned = false;
30236         LDKChannelMonitorUpdate b_conv;
30237         b_conv.inner = untag_ptr(b);
30238         b_conv.is_owned = ptr_is_owned(b);
30239         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30240         b_conv.is_owned = false;
30241         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
30242         return ret_conv;
30243 }
30244
30245 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
30246         LDKChannelMonitorUpdate obj_conv;
30247         obj_conv.inner = untag_ptr(obj);
30248         obj_conv.is_owned = ptr_is_owned(obj);
30249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30250         obj_conv.is_owned = false;
30251         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
30252         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30253         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30254         CVec_u8Z_free(ret_var);
30255         return ret_arr;
30256 }
30257
30258 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
30259         LDKu8slice ser_ref;
30260         ser_ref.datalen = ser->arr_len;
30261         ser_ref.data = ser->elems;
30262         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
30263         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
30264         FREE(ser);
30265         return tag_ptr(ret_conv, true);
30266 }
30267
30268 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
30269         if (!ptr_is_owned(this_ptr)) return;
30270         void* this_ptr_ptr = untag_ptr(this_ptr);
30271         CHECK_ACCESS(this_ptr_ptr);
30272         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
30273         FREE(untag_ptr(this_ptr));
30274         MonitorEvent_free(this_ptr_conv);
30275 }
30276
30277 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
30278         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30279         *ret_copy = MonitorEvent_clone(arg);
30280         uint64_t ret_ref = tag_ptr(ret_copy, true);
30281         return ret_ref;
30282 }
30283 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
30284         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
30285         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
30286         return ret_conv;
30287 }
30288
30289 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
30290         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
30291         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30292         *ret_copy = MonitorEvent_clone(orig_conv);
30293         uint64_t ret_ref = tag_ptr(ret_copy, true);
30294         return ret_ref;
30295 }
30296
30297 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
30298         LDKHTLCUpdate a_conv;
30299         a_conv.inner = untag_ptr(a);
30300         a_conv.is_owned = ptr_is_owned(a);
30301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30302         a_conv = HTLCUpdate_clone(&a_conv);
30303         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30304         *ret_copy = MonitorEvent_htlcevent(a_conv);
30305         uint64_t ret_ref = tag_ptr(ret_copy, true);
30306         return ret_ref;
30307 }
30308
30309 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
30310         LDKOutPoint a_conv;
30311         a_conv.inner = untag_ptr(a);
30312         a_conv.is_owned = ptr_is_owned(a);
30313         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30314         a_conv = OutPoint_clone(&a_conv);
30315         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30316         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
30317         uint64_t ret_ref = tag_ptr(ret_copy, true);
30318         return ret_ref;
30319 }
30320
30321 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
30322         LDKOutPoint funding_txo_conv;
30323         funding_txo_conv.inner = untag_ptr(funding_txo);
30324         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
30325         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
30326         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
30327         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30328         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
30329         uint64_t ret_ref = tag_ptr(ret_copy, true);
30330         return ret_ref;
30331 }
30332
30333 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
30334         LDKOutPoint a_conv;
30335         a_conv.inner = untag_ptr(a);
30336         a_conv.is_owned = ptr_is_owned(a);
30337         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30338         a_conv = OutPoint_clone(&a_conv);
30339         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30340         *ret_copy = MonitorEvent_update_failed(a_conv);
30341         uint64_t ret_ref = tag_ptr(ret_copy, true);
30342         return ret_ref;
30343 }
30344
30345 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
30346         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
30347         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
30348         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
30349         return ret_conv;
30350 }
30351
30352 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
30353         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
30354         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
30355         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30356         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30357         CVec_u8Z_free(ret_var);
30358         return ret_arr;
30359 }
30360
30361 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
30362         LDKu8slice ser_ref;
30363         ser_ref.datalen = ser->arr_len;
30364         ser_ref.data = ser->elems;
30365         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
30366         *ret_conv = MonitorEvent_read(ser_ref);
30367         FREE(ser);
30368         return tag_ptr(ret_conv, true);
30369 }
30370
30371 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
30372         LDKHTLCUpdate this_obj_conv;
30373         this_obj_conv.inner = untag_ptr(this_obj);
30374         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30376         HTLCUpdate_free(this_obj_conv);
30377 }
30378
30379 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
30380         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
30381         uint64_t ret_ref = 0;
30382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30384         return ret_ref;
30385 }
30386 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
30387         LDKHTLCUpdate arg_conv;
30388         arg_conv.inner = untag_ptr(arg);
30389         arg_conv.is_owned = ptr_is_owned(arg);
30390         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30391         arg_conv.is_owned = false;
30392         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
30393         return ret_conv;
30394 }
30395
30396 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
30397         LDKHTLCUpdate orig_conv;
30398         orig_conv.inner = untag_ptr(orig);
30399         orig_conv.is_owned = ptr_is_owned(orig);
30400         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30401         orig_conv.is_owned = false;
30402         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
30403         uint64_t ret_ref = 0;
30404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30406         return ret_ref;
30407 }
30408
30409 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
30410         LDKHTLCUpdate a_conv;
30411         a_conv.inner = untag_ptr(a);
30412         a_conv.is_owned = ptr_is_owned(a);
30413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30414         a_conv.is_owned = false;
30415         LDKHTLCUpdate b_conv;
30416         b_conv.inner = untag_ptr(b);
30417         b_conv.is_owned = ptr_is_owned(b);
30418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30419         b_conv.is_owned = false;
30420         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
30421         return ret_conv;
30422 }
30423
30424 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
30425         LDKHTLCUpdate obj_conv;
30426         obj_conv.inner = untag_ptr(obj);
30427         obj_conv.is_owned = ptr_is_owned(obj);
30428         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30429         obj_conv.is_owned = false;
30430         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
30431         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30432         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30433         CVec_u8Z_free(ret_var);
30434         return ret_arr;
30435 }
30436
30437 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
30438         LDKu8slice ser_ref;
30439         ser_ref.datalen = ser->arr_len;
30440         ser_ref.data = ser->elems;
30441         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
30442         *ret_conv = HTLCUpdate_read(ser_ref);
30443         FREE(ser);
30444         return tag_ptr(ret_conv, true);
30445 }
30446
30447 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
30448         if (!ptr_is_owned(this_ptr)) return;
30449         void* this_ptr_ptr = untag_ptr(this_ptr);
30450         CHECK_ACCESS(this_ptr_ptr);
30451         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
30452         FREE(untag_ptr(this_ptr));
30453         Balance_free(this_ptr_conv);
30454 }
30455
30456 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
30457         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30458         *ret_copy = Balance_clone(arg);
30459         uint64_t ret_ref = tag_ptr(ret_copy, true);
30460         return ret_ref;
30461 }
30462 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
30463         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
30464         int64_t ret_conv = Balance_clone_ptr(arg_conv);
30465         return ret_conv;
30466 }
30467
30468 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
30469         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
30470         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30471         *ret_copy = Balance_clone(orig_conv);
30472         uint64_t ret_ref = tag_ptr(ret_copy, true);
30473         return ret_ref;
30474 }
30475
30476 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
30477         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30478         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
30479         uint64_t ret_ref = tag_ptr(ret_copy, true);
30480         return ret_ref;
30481 }
30482
30483 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
30484         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30485         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
30486         uint64_t ret_ref = tag_ptr(ret_copy, true);
30487         return ret_ref;
30488 }
30489
30490 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) {
30491         LDKThirtyTwoBytes payment_hash_ref;
30492         CHECK(payment_hash->arr_len == 32);
30493         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30494         LDKThirtyTwoBytes payment_preimage_ref;
30495         CHECK(payment_preimage->arr_len == 32);
30496         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
30497         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30498         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
30499         uint64_t ret_ref = tag_ptr(ret_copy, true);
30500         return ret_ref;
30501 }
30502
30503 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) {
30504         LDKThirtyTwoBytes payment_hash_ref;
30505         CHECK(payment_hash->arr_len == 32);
30506         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30507         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30508         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
30509         uint64_t ret_ref = tag_ptr(ret_copy, true);
30510         return ret_ref;
30511 }
30512
30513 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) {
30514         LDKThirtyTwoBytes payment_hash_ref;
30515         CHECK(payment_hash->arr_len == 32);
30516         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30517         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30518         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
30519         uint64_t ret_ref = tag_ptr(ret_copy, true);
30520         return ret_ref;
30521 }
30522
30523 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
30524         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30525         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
30526         uint64_t ret_ref = tag_ptr(ret_copy, true);
30527         return ret_ref;
30528 }
30529
30530 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
30531         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
30532         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
30533         jboolean ret_conv = Balance_eq(a_conv, b_conv);
30534         return ret_conv;
30535 }
30536
30537 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
30538         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
30539         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
30540         return ret_conv;
30541 }
30542
30543 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
30544         LDKChannelMonitor this_obj_conv;
30545         this_obj_conv.inner = untag_ptr(this_obj);
30546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30548         ChannelMonitor_free(this_obj_conv);
30549 }
30550
30551 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
30552         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
30553         uint64_t ret_ref = 0;
30554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30556         return ret_ref;
30557 }
30558 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
30559         LDKChannelMonitor arg_conv;
30560         arg_conv.inner = untag_ptr(arg);
30561         arg_conv.is_owned = ptr_is_owned(arg);
30562         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30563         arg_conv.is_owned = false;
30564         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
30565         return ret_conv;
30566 }
30567
30568 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
30569         LDKChannelMonitor orig_conv;
30570         orig_conv.inner = untag_ptr(orig);
30571         orig_conv.is_owned = ptr_is_owned(orig);
30572         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30573         orig_conv.is_owned = false;
30574         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
30575         uint64_t ret_ref = 0;
30576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30578         return ret_ref;
30579 }
30580
30581 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
30582         LDKChannelMonitor obj_conv;
30583         obj_conv.inner = untag_ptr(obj);
30584         obj_conv.is_owned = ptr_is_owned(obj);
30585         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30586         obj_conv.is_owned = false;
30587         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
30588         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30589         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30590         CVec_u8Z_free(ret_var);
30591         return ret_arr;
30592 }
30593
30594 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) {
30595         LDKChannelMonitor this_arg_conv;
30596         this_arg_conv.inner = untag_ptr(this_arg);
30597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30599         this_arg_conv.is_owned = false;
30600         LDKChannelMonitorUpdate updates_conv;
30601         updates_conv.inner = untag_ptr(updates);
30602         updates_conv.is_owned = ptr_is_owned(updates);
30603         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
30604         updates_conv.is_owned = false;
30605         void* broadcaster_ptr = untag_ptr(broadcaster);
30606         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
30607         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
30608         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30609         CHECK_ACCESS(fee_estimator_ptr);
30610         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30611         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30612                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30613                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30614         }
30615         void* logger_ptr = untag_ptr(logger);
30616         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
30617         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
30618         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
30619         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
30620         return tag_ptr(ret_conv, true);
30621 }
30622
30623 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
30624         LDKChannelMonitor this_arg_conv;
30625         this_arg_conv.inner = untag_ptr(this_arg);
30626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30628         this_arg_conv.is_owned = false;
30629         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
30630         return ret_conv;
30631 }
30632
30633 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
30634         LDKChannelMonitor this_arg_conv;
30635         this_arg_conv.inner = untag_ptr(this_arg);
30636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30638         this_arg_conv.is_owned = false;
30639         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
30640         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
30641         return tag_ptr(ret_conv, true);
30642 }
30643
30644 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
30645         LDKChannelMonitor this_arg_conv;
30646         this_arg_conv.inner = untag_ptr(this_arg);
30647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30649         this_arg_conv.is_owned = false;
30650         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
30651         uint64_tArray ret_arr = NULL;
30652         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30653         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30654         for (size_t o = 0; o < ret_var.datalen; o++) {
30655                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
30656                 *ret_conv_40_conv = ret_var.data[o];
30657                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
30658         }
30659         
30660         FREE(ret_var.data);
30661         return ret_arr;
30662 }
30663
30664 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
30665         LDKChannelMonitor this_arg_conv;
30666         this_arg_conv.inner = untag_ptr(this_arg);
30667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30669         this_arg_conv.is_owned = false;
30670         void* filter_ptr = untag_ptr(filter);
30671         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
30672         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
30673         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
30674 }
30675
30676 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) {
30677         LDKChannelMonitor this_arg_conv;
30678         this_arg_conv.inner = untag_ptr(this_arg);
30679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30681         this_arg_conv.is_owned = false;
30682         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
30683         uint64_tArray ret_arr = NULL;
30684         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30685         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30686         for (size_t o = 0; o < ret_var.datalen; o++) {
30687                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30688                 *ret_conv_14_copy = ret_var.data[o];
30689                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
30690                 ret_arr_ptr[o] = ret_conv_14_ref;
30691         }
30692         
30693         FREE(ret_var.data);
30694         return ret_arr;
30695 }
30696
30697 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
30698         LDKChannelMonitor this_arg_conv;
30699         this_arg_conv.inner = untag_ptr(this_arg);
30700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30702         this_arg_conv.is_owned = false;
30703         void* handler_ptr = untag_ptr(handler);
30704         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
30705         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
30706         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
30707 }
30708
30709 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
30710         LDKChannelMonitor this_arg_conv;
30711         this_arg_conv.inner = untag_ptr(this_arg);
30712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30714         this_arg_conv.is_owned = false;
30715         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30716         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
30717         return ret_arr;
30718 }
30719
30720 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) {
30721         LDKChannelMonitor this_arg_conv;
30722         this_arg_conv.inner = untag_ptr(this_arg);
30723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30725         this_arg_conv.is_owned = false;
30726         void* logger_ptr = untag_ptr(logger);
30727         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
30728         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
30729         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
30730         ptrArray ret_arr = NULL;
30731         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
30732         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
30733         for (size_t m = 0; m < ret_var.datalen; m++) {
30734                 LDKTransaction ret_conv_12_var = ret_var.data[m];
30735                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
30736                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
30737                 Transaction_free(ret_conv_12_var);
30738                 ret_arr_ptr[m] = ret_conv_12_arr;
30739         }
30740         
30741         FREE(ret_var.data);
30742         return ret_arr;
30743 }
30744
30745 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) {
30746         LDKChannelMonitor this_arg_conv;
30747         this_arg_conv.inner = untag_ptr(this_arg);
30748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30750         this_arg_conv.is_owned = false;
30751         uint8_t header_arr[80];
30752         CHECK(header->arr_len == 80);
30753         memcpy(header_arr, header->elems, 80); FREE(header);
30754         uint8_t (*header_ref)[80] = &header_arr;
30755         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
30756         txdata_constr.datalen = txdata->arr_len;
30757         if (txdata_constr.datalen > 0)
30758                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
30759         else
30760                 txdata_constr.data = NULL;
30761         uint64_t* txdata_vals = txdata->elems;
30762         for (size_t c = 0; c < txdata_constr.datalen; c++) {
30763                 uint64_t txdata_conv_28 = txdata_vals[c];
30764                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
30765                 CHECK_ACCESS(txdata_conv_28_ptr);
30766                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
30767                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
30768                 txdata_constr.data[c] = txdata_conv_28_conv;
30769         }
30770         FREE(txdata);
30771         void* broadcaster_ptr = untag_ptr(broadcaster);
30772         CHECK_ACCESS(broadcaster_ptr);
30773         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30774         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30775                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30776                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30777         }
30778         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30779         CHECK_ACCESS(fee_estimator_ptr);
30780         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30781         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30782                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30783                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30784         }
30785         void* logger_ptr = untag_ptr(logger);
30786         CHECK_ACCESS(logger_ptr);
30787         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30788         if (logger_conv.free == LDKLogger_JCalls_free) {
30789                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30790                 LDKLogger_JCalls_cloned(&logger_conv);
30791         }
30792         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30793         uint64_tArray ret_arr = NULL;
30794         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30795         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30796         for (size_t n = 0; n < ret_var.datalen; n++) {
30797                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30798                 *ret_conv_39_conv = ret_var.data[n];
30799                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30800         }
30801         
30802         FREE(ret_var.data);
30803         return ret_arr;
30804 }
30805
30806 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) {
30807         LDKChannelMonitor this_arg_conv;
30808         this_arg_conv.inner = untag_ptr(this_arg);
30809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30811         this_arg_conv.is_owned = false;
30812         uint8_t header_arr[80];
30813         CHECK(header->arr_len == 80);
30814         memcpy(header_arr, header->elems, 80); FREE(header);
30815         uint8_t (*header_ref)[80] = &header_arr;
30816         void* broadcaster_ptr = untag_ptr(broadcaster);
30817         CHECK_ACCESS(broadcaster_ptr);
30818         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30819         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30820                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30821                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30822         }
30823         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30824         CHECK_ACCESS(fee_estimator_ptr);
30825         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30826         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30827                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30828                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30829         }
30830         void* logger_ptr = untag_ptr(logger);
30831         CHECK_ACCESS(logger_ptr);
30832         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30833         if (logger_conv.free == LDKLogger_JCalls_free) {
30834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30835                 LDKLogger_JCalls_cloned(&logger_conv);
30836         }
30837         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30838 }
30839
30840 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) {
30841         LDKChannelMonitor this_arg_conv;
30842         this_arg_conv.inner = untag_ptr(this_arg);
30843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30845         this_arg_conv.is_owned = false;
30846         uint8_t header_arr[80];
30847         CHECK(header->arr_len == 80);
30848         memcpy(header_arr, header->elems, 80); FREE(header);
30849         uint8_t (*header_ref)[80] = &header_arr;
30850         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
30851         txdata_constr.datalen = txdata->arr_len;
30852         if (txdata_constr.datalen > 0)
30853                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
30854         else
30855                 txdata_constr.data = NULL;
30856         uint64_t* txdata_vals = txdata->elems;
30857         for (size_t c = 0; c < txdata_constr.datalen; c++) {
30858                 uint64_t txdata_conv_28 = txdata_vals[c];
30859                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
30860                 CHECK_ACCESS(txdata_conv_28_ptr);
30861                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
30862                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
30863                 txdata_constr.data[c] = txdata_conv_28_conv;
30864         }
30865         FREE(txdata);
30866         void* broadcaster_ptr = untag_ptr(broadcaster);
30867         CHECK_ACCESS(broadcaster_ptr);
30868         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30869         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30870                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30871                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30872         }
30873         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30874         CHECK_ACCESS(fee_estimator_ptr);
30875         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30876         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30878                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30879         }
30880         void* logger_ptr = untag_ptr(logger);
30881         CHECK_ACCESS(logger_ptr);
30882         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30883         if (logger_conv.free == LDKLogger_JCalls_free) {
30884                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30885                 LDKLogger_JCalls_cloned(&logger_conv);
30886         }
30887         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30888         uint64_tArray ret_arr = NULL;
30889         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30890         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30891         for (size_t n = 0; n < ret_var.datalen; n++) {
30892                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30893                 *ret_conv_39_conv = ret_var.data[n];
30894                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30895         }
30896         
30897         FREE(ret_var.data);
30898         return ret_arr;
30899 }
30900
30901 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) {
30902         LDKChannelMonitor this_arg_conv;
30903         this_arg_conv.inner = untag_ptr(this_arg);
30904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30906         this_arg_conv.is_owned = false;
30907         uint8_t txid_arr[32];
30908         CHECK(txid->arr_len == 32);
30909         memcpy(txid_arr, txid->elems, 32); FREE(txid);
30910         uint8_t (*txid_ref)[32] = &txid_arr;
30911         void* broadcaster_ptr = untag_ptr(broadcaster);
30912         CHECK_ACCESS(broadcaster_ptr);
30913         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30914         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30915                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30916                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30917         }
30918         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30919         CHECK_ACCESS(fee_estimator_ptr);
30920         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30921         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30922                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30923                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30924         }
30925         void* logger_ptr = untag_ptr(logger);
30926         CHECK_ACCESS(logger_ptr);
30927         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30928         if (logger_conv.free == LDKLogger_JCalls_free) {
30929                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30930                 LDKLogger_JCalls_cloned(&logger_conv);
30931         }
30932         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
30933 }
30934
30935 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) {
30936         LDKChannelMonitor this_arg_conv;
30937         this_arg_conv.inner = untag_ptr(this_arg);
30938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30940         this_arg_conv.is_owned = false;
30941         uint8_t header_arr[80];
30942         CHECK(header->arr_len == 80);
30943         memcpy(header_arr, header->elems, 80); FREE(header);
30944         uint8_t (*header_ref)[80] = &header_arr;
30945         void* broadcaster_ptr = untag_ptr(broadcaster);
30946         CHECK_ACCESS(broadcaster_ptr);
30947         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30948         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30949                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30950                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30951         }
30952         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30953         CHECK_ACCESS(fee_estimator_ptr);
30954         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30955         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30956                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30957                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30958         }
30959         void* logger_ptr = untag_ptr(logger);
30960         CHECK_ACCESS(logger_ptr);
30961         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30962         if (logger_conv.free == LDKLogger_JCalls_free) {
30963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30964                 LDKLogger_JCalls_cloned(&logger_conv);
30965         }
30966         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30967         uint64_tArray ret_arr = NULL;
30968         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30969         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30970         for (size_t n = 0; n < ret_var.datalen; n++) {
30971                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30972                 *ret_conv_39_conv = ret_var.data[n];
30973                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30974         }
30975         
30976         FREE(ret_var.data);
30977         return ret_arr;
30978 }
30979
30980 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
30981         LDKChannelMonitor this_arg_conv;
30982         this_arg_conv.inner = untag_ptr(this_arg);
30983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30985         this_arg_conv.is_owned = false;
30986         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
30987         uint64_tArray ret_arr = NULL;
30988         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30989         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30990         for (size_t i = 0; i < ret_var.datalen; i++) {
30991                 LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv_34_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
30992                 *ret_conv_34_conv = ret_var.data[i];
30993                 ret_arr_ptr[i] = tag_ptr(ret_conv_34_conv, true);
30994         }
30995         
30996         FREE(ret_var.data);
30997         return ret_arr;
30998 }
30999
31000 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
31001         LDKChannelMonitor this_arg_conv;
31002         this_arg_conv.inner = untag_ptr(this_arg);
31003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31005         this_arg_conv.is_owned = false;
31006         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
31007         uint64_t ret_ref = 0;
31008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31010         return ret_ref;
31011 }
31012
31013 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) {
31014         LDKChannelMonitor this_arg_conv;
31015         this_arg_conv.inner = untag_ptr(this_arg);
31016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31018         this_arg_conv.is_owned = false;
31019         void* broadcaster_ptr = untag_ptr(broadcaster);
31020         CHECK_ACCESS(broadcaster_ptr);
31021         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
31022         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
31023                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31024                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
31025         }
31026         void* fee_estimator_ptr = untag_ptr(fee_estimator);
31027         CHECK_ACCESS(fee_estimator_ptr);
31028         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
31029         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
31030                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31031                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
31032         }
31033         void* logger_ptr = untag_ptr(logger);
31034         CHECK_ACCESS(logger_ptr);
31035         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31036         if (logger_conv.free == LDKLogger_JCalls_free) {
31037                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31038                 LDKLogger_JCalls_cloned(&logger_conv);
31039         }
31040         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
31041 }
31042
31043 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
31044         LDKChannelMonitor this_arg_conv;
31045         this_arg_conv.inner = untag_ptr(this_arg);
31046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31048         this_arg_conv.is_owned = false;
31049         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
31050         uint64_tArray ret_arr = NULL;
31051         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31052         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31053         for (size_t j = 0; j < ret_var.datalen; j++) {
31054                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
31055                 *ret_conv_9_copy = ret_var.data[j];
31056                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
31057                 ret_arr_ptr[j] = ret_conv_9_ref;
31058         }
31059         
31060         FREE(ret_var.data);
31061         return ret_arr;
31062 }
31063
31064 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
31065         LDKu8slice ser_ref;
31066         ser_ref.datalen = ser->arr_len;
31067         ser_ref.data = ser->elems;
31068         void* arg_a_ptr = untag_ptr(arg_a);
31069         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
31070         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
31071         void* arg_b_ptr = untag_ptr(arg_b);
31072         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
31073         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
31074         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
31075         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
31076         FREE(ser);
31077         return tag_ptr(ret_conv, true);
31078 }
31079
31080 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
31081         LDKOutPoint this_obj_conv;
31082         this_obj_conv.inner = untag_ptr(this_obj);
31083         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31085         OutPoint_free(this_obj_conv);
31086 }
31087
31088 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
31089         LDKOutPoint this_ptr_conv;
31090         this_ptr_conv.inner = untag_ptr(this_ptr);
31091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31093         this_ptr_conv.is_owned = false;
31094         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31095         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
31096         return ret_arr;
31097 }
31098
31099 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
31100         LDKOutPoint this_ptr_conv;
31101         this_ptr_conv.inner = untag_ptr(this_ptr);
31102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31104         this_ptr_conv.is_owned = false;
31105         LDKThirtyTwoBytes val_ref;
31106         CHECK(val->arr_len == 32);
31107         memcpy(val_ref.data, val->elems, 32); FREE(val);
31108         OutPoint_set_txid(&this_ptr_conv, val_ref);
31109 }
31110
31111 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
31112         LDKOutPoint this_ptr_conv;
31113         this_ptr_conv.inner = untag_ptr(this_ptr);
31114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31116         this_ptr_conv.is_owned = false;
31117         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
31118         return ret_conv;
31119 }
31120
31121 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
31122         LDKOutPoint this_ptr_conv;
31123         this_ptr_conv.inner = untag_ptr(this_ptr);
31124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31126         this_ptr_conv.is_owned = false;
31127         OutPoint_set_index(&this_ptr_conv, val);
31128 }
31129
31130 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
31131         LDKThirtyTwoBytes txid_arg_ref;
31132         CHECK(txid_arg->arr_len == 32);
31133         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
31134         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
31135         uint64_t ret_ref = 0;
31136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31138         return ret_ref;
31139 }
31140
31141 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
31142         LDKOutPoint ret_var = OutPoint_clone(arg);
31143         uint64_t ret_ref = 0;
31144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31146         return ret_ref;
31147 }
31148 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
31149         LDKOutPoint arg_conv;
31150         arg_conv.inner = untag_ptr(arg);
31151         arg_conv.is_owned = ptr_is_owned(arg);
31152         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31153         arg_conv.is_owned = false;
31154         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
31155         return ret_conv;
31156 }
31157
31158 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
31159         LDKOutPoint orig_conv;
31160         orig_conv.inner = untag_ptr(orig);
31161         orig_conv.is_owned = ptr_is_owned(orig);
31162         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31163         orig_conv.is_owned = false;
31164         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
31165         uint64_t ret_ref = 0;
31166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31168         return ret_ref;
31169 }
31170
31171 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
31172         LDKOutPoint a_conv;
31173         a_conv.inner = untag_ptr(a);
31174         a_conv.is_owned = ptr_is_owned(a);
31175         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31176         a_conv.is_owned = false;
31177         LDKOutPoint b_conv;
31178         b_conv.inner = untag_ptr(b);
31179         b_conv.is_owned = ptr_is_owned(b);
31180         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31181         b_conv.is_owned = false;
31182         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
31183         return ret_conv;
31184 }
31185
31186 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
31187         LDKOutPoint o_conv;
31188         o_conv.inner = untag_ptr(o);
31189         o_conv.is_owned = ptr_is_owned(o);
31190         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31191         o_conv.is_owned = false;
31192         int64_t ret_conv = OutPoint_hash(&o_conv);
31193         return ret_conv;
31194 }
31195
31196 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
31197         LDKOutPoint this_arg_conv;
31198         this_arg_conv.inner = untag_ptr(this_arg);
31199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31201         this_arg_conv.is_owned = false;
31202         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31203         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
31204         return ret_arr;
31205 }
31206
31207 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
31208         LDKOutPoint obj_conv;
31209         obj_conv.inner = untag_ptr(obj);
31210         obj_conv.is_owned = ptr_is_owned(obj);
31211         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31212         obj_conv.is_owned = false;
31213         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
31214         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31215         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31216         CVec_u8Z_free(ret_var);
31217         return ret_arr;
31218 }
31219
31220 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
31221         LDKu8slice ser_ref;
31222         ser_ref.datalen = ser->arr_len;
31223         ser_ref.data = ser->elems;
31224         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31225         *ret_conv = OutPoint_read(ser_ref);
31226         FREE(ser);
31227         return tag_ptr(ret_conv, true);
31228 }
31229
31230 uint32_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
31231         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
31232         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv));
31233         return ret_conv;
31234 }
31235
31236 uint32_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
31237         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure());
31238         return ret_conv;
31239 }
31240
31241 uint32_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
31242         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing());
31243         return ret_conv;
31244 }
31245
31246 uint32_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
31247         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details());
31248         return ret_conv;
31249 }
31250
31251 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
31252         LDKChannelManager this_obj_conv;
31253         this_obj_conv.inner = untag_ptr(this_obj);
31254         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31256         ChannelManager_free(this_obj_conv);
31257 }
31258
31259 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
31260         LDKChainParameters this_obj_conv;
31261         this_obj_conv.inner = untag_ptr(this_obj);
31262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31264         ChainParameters_free(this_obj_conv);
31265 }
31266
31267 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
31268         LDKChainParameters this_ptr_conv;
31269         this_ptr_conv.inner = untag_ptr(this_ptr);
31270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31272         this_ptr_conv.is_owned = false;
31273         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
31274         return ret_conv;
31275 }
31276
31277 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
31278         LDKChainParameters this_ptr_conv;
31279         this_ptr_conv.inner = untag_ptr(this_ptr);
31280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31282         this_ptr_conv.is_owned = false;
31283         LDKNetwork val_conv = LDKNetwork_from_js(val);
31284         ChainParameters_set_network(&this_ptr_conv, val_conv);
31285 }
31286
31287 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
31288         LDKChainParameters this_ptr_conv;
31289         this_ptr_conv.inner = untag_ptr(this_ptr);
31290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31292         this_ptr_conv.is_owned = false;
31293         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
31294         uint64_t ret_ref = 0;
31295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31297         return ret_ref;
31298 }
31299
31300 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
31301         LDKChainParameters this_ptr_conv;
31302         this_ptr_conv.inner = untag_ptr(this_ptr);
31303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31305         this_ptr_conv.is_owned = false;
31306         LDKBestBlock val_conv;
31307         val_conv.inner = untag_ptr(val);
31308         val_conv.is_owned = ptr_is_owned(val);
31309         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31310         val_conv = BestBlock_clone(&val_conv);
31311         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
31312 }
31313
31314 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
31315         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
31316         LDKBestBlock best_block_arg_conv;
31317         best_block_arg_conv.inner = untag_ptr(best_block_arg);
31318         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
31319         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
31320         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
31321         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
31322         uint64_t ret_ref = 0;
31323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31325         return ret_ref;
31326 }
31327
31328 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
31329         LDKChainParameters ret_var = ChainParameters_clone(arg);
31330         uint64_t ret_ref = 0;
31331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31333         return ret_ref;
31334 }
31335 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
31336         LDKChainParameters arg_conv;
31337         arg_conv.inner = untag_ptr(arg);
31338         arg_conv.is_owned = ptr_is_owned(arg);
31339         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31340         arg_conv.is_owned = false;
31341         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
31342         return ret_conv;
31343 }
31344
31345 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
31346         LDKChainParameters orig_conv;
31347         orig_conv.inner = untag_ptr(orig);
31348         orig_conv.is_owned = ptr_is_owned(orig);
31349         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31350         orig_conv.is_owned = false;
31351         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
31352         uint64_t ret_ref = 0;
31353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31355         return ret_ref;
31356 }
31357
31358 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
31359         LDKCounterpartyForwardingInfo this_obj_conv;
31360         this_obj_conv.inner = untag_ptr(this_obj);
31361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31363         CounterpartyForwardingInfo_free(this_obj_conv);
31364 }
31365
31366 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
31367         LDKCounterpartyForwardingInfo this_ptr_conv;
31368         this_ptr_conv.inner = untag_ptr(this_ptr);
31369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31371         this_ptr_conv.is_owned = false;
31372         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
31373         return ret_conv;
31374 }
31375
31376 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
31377         LDKCounterpartyForwardingInfo this_ptr_conv;
31378         this_ptr_conv.inner = untag_ptr(this_ptr);
31379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31381         this_ptr_conv.is_owned = false;
31382         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
31383 }
31384
31385 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
31386         LDKCounterpartyForwardingInfo this_ptr_conv;
31387         this_ptr_conv.inner = untag_ptr(this_ptr);
31388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31390         this_ptr_conv.is_owned = false;
31391         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
31392         return ret_conv;
31393 }
31394
31395 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
31396         LDKCounterpartyForwardingInfo this_ptr_conv;
31397         this_ptr_conv.inner = untag_ptr(this_ptr);
31398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31400         this_ptr_conv.is_owned = false;
31401         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
31402 }
31403
31404 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
31405         LDKCounterpartyForwardingInfo this_ptr_conv;
31406         this_ptr_conv.inner = untag_ptr(this_ptr);
31407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31409         this_ptr_conv.is_owned = false;
31410         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
31411         return ret_conv;
31412 }
31413
31414 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
31415         LDKCounterpartyForwardingInfo this_ptr_conv;
31416         this_ptr_conv.inner = untag_ptr(this_ptr);
31417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31419         this_ptr_conv.is_owned = false;
31420         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
31421 }
31422
31423 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) {
31424         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
31425         uint64_t ret_ref = 0;
31426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31428         return ret_ref;
31429 }
31430
31431 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
31432         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
31433         uint64_t ret_ref = 0;
31434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31436         return ret_ref;
31437 }
31438 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
31439         LDKCounterpartyForwardingInfo arg_conv;
31440         arg_conv.inner = untag_ptr(arg);
31441         arg_conv.is_owned = ptr_is_owned(arg);
31442         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31443         arg_conv.is_owned = false;
31444         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
31445         return ret_conv;
31446 }
31447
31448 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
31449         LDKCounterpartyForwardingInfo orig_conv;
31450         orig_conv.inner = untag_ptr(orig);
31451         orig_conv.is_owned = ptr_is_owned(orig);
31452         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31453         orig_conv.is_owned = false;
31454         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
31455         uint64_t ret_ref = 0;
31456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31458         return ret_ref;
31459 }
31460
31461 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
31462         LDKChannelCounterparty this_obj_conv;
31463         this_obj_conv.inner = untag_ptr(this_obj);
31464         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31466         ChannelCounterparty_free(this_obj_conv);
31467 }
31468
31469 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
31470         LDKChannelCounterparty this_ptr_conv;
31471         this_ptr_conv.inner = untag_ptr(this_ptr);
31472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31474         this_ptr_conv.is_owned = false;
31475         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31476         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
31477         return ret_arr;
31478 }
31479
31480 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
31481         LDKChannelCounterparty this_ptr_conv;
31482         this_ptr_conv.inner = untag_ptr(this_ptr);
31483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31485         this_ptr_conv.is_owned = false;
31486         LDKPublicKey val_ref;
31487         CHECK(val->arr_len == 33);
31488         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31489         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
31490 }
31491
31492 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
31493         LDKChannelCounterparty this_ptr_conv;
31494         this_ptr_conv.inner = untag_ptr(this_ptr);
31495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31497         this_ptr_conv.is_owned = false;
31498         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
31499         uint64_t ret_ref = 0;
31500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31502         return ret_ref;
31503 }
31504
31505 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
31506         LDKChannelCounterparty this_ptr_conv;
31507         this_ptr_conv.inner = untag_ptr(this_ptr);
31508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31510         this_ptr_conv.is_owned = false;
31511         LDKInitFeatures val_conv;
31512         val_conv.inner = untag_ptr(val);
31513         val_conv.is_owned = ptr_is_owned(val);
31514         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31515         val_conv = InitFeatures_clone(&val_conv);
31516         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
31517 }
31518
31519 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
31520         LDKChannelCounterparty this_ptr_conv;
31521         this_ptr_conv.inner = untag_ptr(this_ptr);
31522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31524         this_ptr_conv.is_owned = false;
31525         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
31526         return ret_conv;
31527 }
31528
31529 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
31530         LDKChannelCounterparty this_ptr_conv;
31531         this_ptr_conv.inner = untag_ptr(this_ptr);
31532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31534         this_ptr_conv.is_owned = false;
31535         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
31536 }
31537
31538 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
31539         LDKChannelCounterparty this_ptr_conv;
31540         this_ptr_conv.inner = untag_ptr(this_ptr);
31541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31543         this_ptr_conv.is_owned = false;
31544         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
31545         uint64_t ret_ref = 0;
31546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31548         return ret_ref;
31549 }
31550
31551 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
31552         LDKChannelCounterparty this_ptr_conv;
31553         this_ptr_conv.inner = untag_ptr(this_ptr);
31554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31556         this_ptr_conv.is_owned = false;
31557         LDKCounterpartyForwardingInfo val_conv;
31558         val_conv.inner = untag_ptr(val);
31559         val_conv.is_owned = ptr_is_owned(val);
31560         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31561         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
31562         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
31563 }
31564
31565 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
31566         LDKChannelCounterparty this_ptr_conv;
31567         this_ptr_conv.inner = untag_ptr(this_ptr);
31568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31570         this_ptr_conv.is_owned = false;
31571         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31572         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
31573         uint64_t ret_ref = tag_ptr(ret_copy, true);
31574         return ret_ref;
31575 }
31576
31577 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) {
31578         LDKChannelCounterparty this_ptr_conv;
31579         this_ptr_conv.inner = untag_ptr(this_ptr);
31580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31582         this_ptr_conv.is_owned = false;
31583         void* val_ptr = untag_ptr(val);
31584         CHECK_ACCESS(val_ptr);
31585         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31586         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31587         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
31588 }
31589
31590 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
31591         LDKChannelCounterparty this_ptr_conv;
31592         this_ptr_conv.inner = untag_ptr(this_ptr);
31593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31595         this_ptr_conv.is_owned = false;
31596         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31597         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
31598         uint64_t ret_ref = tag_ptr(ret_copy, true);
31599         return ret_ref;
31600 }
31601
31602 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) {
31603         LDKChannelCounterparty this_ptr_conv;
31604         this_ptr_conv.inner = untag_ptr(this_ptr);
31605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31607         this_ptr_conv.is_owned = false;
31608         void* val_ptr = untag_ptr(val);
31609         CHECK_ACCESS(val_ptr);
31610         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31611         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31612         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
31613 }
31614
31615 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) {
31616         LDKPublicKey node_id_arg_ref;
31617         CHECK(node_id_arg->arr_len == 33);
31618         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
31619         LDKInitFeatures features_arg_conv;
31620         features_arg_conv.inner = untag_ptr(features_arg);
31621         features_arg_conv.is_owned = ptr_is_owned(features_arg);
31622         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
31623         features_arg_conv = InitFeatures_clone(&features_arg_conv);
31624         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
31625         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
31626         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
31627         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
31628         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
31629         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
31630         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
31631         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
31632         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
31633         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
31634         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
31635         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
31636         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
31637         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);
31638         uint64_t ret_ref = 0;
31639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31641         return ret_ref;
31642 }
31643
31644 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
31645         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
31646         uint64_t ret_ref = 0;
31647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31649         return ret_ref;
31650 }
31651 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
31652         LDKChannelCounterparty arg_conv;
31653         arg_conv.inner = untag_ptr(arg);
31654         arg_conv.is_owned = ptr_is_owned(arg);
31655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31656         arg_conv.is_owned = false;
31657         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
31658         return ret_conv;
31659 }
31660
31661 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
31662         LDKChannelCounterparty orig_conv;
31663         orig_conv.inner = untag_ptr(orig);
31664         orig_conv.is_owned = ptr_is_owned(orig);
31665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31666         orig_conv.is_owned = false;
31667         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
31668         uint64_t ret_ref = 0;
31669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31671         return ret_ref;
31672 }
31673
31674 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
31675         LDKChannelDetails this_obj_conv;
31676         this_obj_conv.inner = untag_ptr(this_obj);
31677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31679         ChannelDetails_free(this_obj_conv);
31680 }
31681
31682 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
31683         LDKChannelDetails this_ptr_conv;
31684         this_ptr_conv.inner = untag_ptr(this_ptr);
31685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31687         this_ptr_conv.is_owned = false;
31688         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31689         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
31690         return ret_arr;
31691 }
31692
31693 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31694         LDKChannelDetails this_ptr_conv;
31695         this_ptr_conv.inner = untag_ptr(this_ptr);
31696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31698         this_ptr_conv.is_owned = false;
31699         LDKThirtyTwoBytes val_ref;
31700         CHECK(val->arr_len == 32);
31701         memcpy(val_ref.data, val->elems, 32); FREE(val);
31702         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
31703 }
31704
31705 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
31706         LDKChannelDetails this_ptr_conv;
31707         this_ptr_conv.inner = untag_ptr(this_ptr);
31708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31710         this_ptr_conv.is_owned = false;
31711         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
31712         uint64_t ret_ref = 0;
31713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31715         return ret_ref;
31716 }
31717
31718 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
31719         LDKChannelDetails this_ptr_conv;
31720         this_ptr_conv.inner = untag_ptr(this_ptr);
31721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31723         this_ptr_conv.is_owned = false;
31724         LDKChannelCounterparty val_conv;
31725         val_conv.inner = untag_ptr(val);
31726         val_conv.is_owned = ptr_is_owned(val);
31727         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31728         val_conv = ChannelCounterparty_clone(&val_conv);
31729         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
31730 }
31731
31732 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
31733         LDKChannelDetails this_ptr_conv;
31734         this_ptr_conv.inner = untag_ptr(this_ptr);
31735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31737         this_ptr_conv.is_owned = false;
31738         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
31739         uint64_t ret_ref = 0;
31740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31742         return ret_ref;
31743 }
31744
31745 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
31746         LDKChannelDetails this_ptr_conv;
31747         this_ptr_conv.inner = untag_ptr(this_ptr);
31748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31750         this_ptr_conv.is_owned = false;
31751         LDKOutPoint val_conv;
31752         val_conv.inner = untag_ptr(val);
31753         val_conv.is_owned = ptr_is_owned(val);
31754         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31755         val_conv = OutPoint_clone(&val_conv);
31756         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
31757 }
31758
31759 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
31760         LDKChannelDetails this_ptr_conv;
31761         this_ptr_conv.inner = untag_ptr(this_ptr);
31762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31764         this_ptr_conv.is_owned = false;
31765         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
31766         uint64_t ret_ref = 0;
31767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31769         return ret_ref;
31770 }
31771
31772 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
31773         LDKChannelDetails this_ptr_conv;
31774         this_ptr_conv.inner = untag_ptr(this_ptr);
31775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31777         this_ptr_conv.is_owned = false;
31778         LDKChannelTypeFeatures val_conv;
31779         val_conv.inner = untag_ptr(val);
31780         val_conv.is_owned = ptr_is_owned(val);
31781         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31782         val_conv = ChannelTypeFeatures_clone(&val_conv);
31783         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
31784 }
31785
31786 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
31787         LDKChannelDetails this_ptr_conv;
31788         this_ptr_conv.inner = untag_ptr(this_ptr);
31789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31791         this_ptr_conv.is_owned = false;
31792         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31793         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
31794         uint64_t ret_ref = tag_ptr(ret_copy, true);
31795         return ret_ref;
31796 }
31797
31798 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
31799         LDKChannelDetails this_ptr_conv;
31800         this_ptr_conv.inner = untag_ptr(this_ptr);
31801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31803         this_ptr_conv.is_owned = false;
31804         void* val_ptr = untag_ptr(val);
31805         CHECK_ACCESS(val_ptr);
31806         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31807         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31808         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
31809 }
31810
31811 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
31812         LDKChannelDetails this_ptr_conv;
31813         this_ptr_conv.inner = untag_ptr(this_ptr);
31814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31816         this_ptr_conv.is_owned = false;
31817         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31818         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
31819         uint64_t ret_ref = tag_ptr(ret_copy, true);
31820         return ret_ref;
31821 }
31822
31823 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
31824         LDKChannelDetails this_ptr_conv;
31825         this_ptr_conv.inner = untag_ptr(this_ptr);
31826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31828         this_ptr_conv.is_owned = false;
31829         void* val_ptr = untag_ptr(val);
31830         CHECK_ACCESS(val_ptr);
31831         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31832         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31833         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
31834 }
31835
31836 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
31837         LDKChannelDetails this_ptr_conv;
31838         this_ptr_conv.inner = untag_ptr(this_ptr);
31839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31841         this_ptr_conv.is_owned = false;
31842         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31843         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
31844         uint64_t ret_ref = tag_ptr(ret_copy, true);
31845         return ret_ref;
31846 }
31847
31848 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
31849         LDKChannelDetails this_ptr_conv;
31850         this_ptr_conv.inner = untag_ptr(this_ptr);
31851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31853         this_ptr_conv.is_owned = false;
31854         void* val_ptr = untag_ptr(val);
31855         CHECK_ACCESS(val_ptr);
31856         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31857         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31858         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
31859 }
31860
31861 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
31862         LDKChannelDetails this_ptr_conv;
31863         this_ptr_conv.inner = untag_ptr(this_ptr);
31864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31866         this_ptr_conv.is_owned = false;
31867         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
31868         return ret_conv;
31869 }
31870
31871 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
31872         LDKChannelDetails this_ptr_conv;
31873         this_ptr_conv.inner = untag_ptr(this_ptr);
31874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31876         this_ptr_conv.is_owned = false;
31877         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
31878 }
31879
31880 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
31881         LDKChannelDetails this_ptr_conv;
31882         this_ptr_conv.inner = untag_ptr(this_ptr);
31883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31885         this_ptr_conv.is_owned = false;
31886         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31887         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
31888         uint64_t ret_ref = tag_ptr(ret_copy, true);
31889         return ret_ref;
31890 }
31891
31892 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
31893         LDKChannelDetails this_ptr_conv;
31894         this_ptr_conv.inner = untag_ptr(this_ptr);
31895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31897         this_ptr_conv.is_owned = false;
31898         void* val_ptr = untag_ptr(val);
31899         CHECK_ACCESS(val_ptr);
31900         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31901         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31902         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
31903 }
31904
31905 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
31906         LDKChannelDetails this_ptr_conv;
31907         this_ptr_conv.inner = untag_ptr(this_ptr);
31908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31910         this_ptr_conv.is_owned = false;
31911         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
31912         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
31913         return ret_arr;
31914 }
31915
31916 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
31917         LDKChannelDetails this_ptr_conv;
31918         this_ptr_conv.inner = untag_ptr(this_ptr);
31919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31921         this_ptr_conv.is_owned = false;
31922         LDKU128 val_ref;
31923         CHECK(val->arr_len == 16);
31924         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
31925         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
31926 }
31927
31928 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) {
31929         LDKChannelDetails this_ptr_conv;
31930         this_ptr_conv.inner = untag_ptr(this_ptr);
31931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31933         this_ptr_conv.is_owned = false;
31934         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
31935         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
31936         uint64_t ret_ref = tag_ptr(ret_copy, true);
31937         return ret_ref;
31938 }
31939
31940 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) {
31941         LDKChannelDetails this_ptr_conv;
31942         this_ptr_conv.inner = untag_ptr(this_ptr);
31943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31945         this_ptr_conv.is_owned = false;
31946         void* val_ptr = untag_ptr(val);
31947         CHECK_ACCESS(val_ptr);
31948         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
31949         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
31950         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
31951 }
31952
31953 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
31954         LDKChannelDetails this_ptr_conv;
31955         this_ptr_conv.inner = untag_ptr(this_ptr);
31956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31958         this_ptr_conv.is_owned = false;
31959         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
31960         return ret_conv;
31961 }
31962
31963 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
31964         LDKChannelDetails this_ptr_conv;
31965         this_ptr_conv.inner = untag_ptr(this_ptr);
31966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31968         this_ptr_conv.is_owned = false;
31969         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
31970 }
31971
31972 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
31973         LDKChannelDetails this_ptr_conv;
31974         this_ptr_conv.inner = untag_ptr(this_ptr);
31975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31977         this_ptr_conv.is_owned = false;
31978         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
31979         return ret_conv;
31980 }
31981
31982 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
31983         LDKChannelDetails this_ptr_conv;
31984         this_ptr_conv.inner = untag_ptr(this_ptr);
31985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31987         this_ptr_conv.is_owned = false;
31988         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
31989 }
31990
31991 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) {
31992         LDKChannelDetails this_ptr_conv;
31993         this_ptr_conv.inner = untag_ptr(this_ptr);
31994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31996         this_ptr_conv.is_owned = false;
31997         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
31998         return ret_conv;
31999 }
32000
32001 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) {
32002         LDKChannelDetails this_ptr_conv;
32003         this_ptr_conv.inner = untag_ptr(this_ptr);
32004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32006         this_ptr_conv.is_owned = false;
32007         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
32008 }
32009
32010 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) {
32011         LDKChannelDetails this_ptr_conv;
32012         this_ptr_conv.inner = untag_ptr(this_ptr);
32013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32015         this_ptr_conv.is_owned = false;
32016         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
32017         return ret_conv;
32018 }
32019
32020 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) {
32021         LDKChannelDetails this_ptr_conv;
32022         this_ptr_conv.inner = untag_ptr(this_ptr);
32023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32025         this_ptr_conv.is_owned = false;
32026         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
32027 }
32028
32029 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
32030         LDKChannelDetails this_ptr_conv;
32031         this_ptr_conv.inner = untag_ptr(this_ptr);
32032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32034         this_ptr_conv.is_owned = false;
32035         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
32036         return ret_conv;
32037 }
32038
32039 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
32040         LDKChannelDetails this_ptr_conv;
32041         this_ptr_conv.inner = untag_ptr(this_ptr);
32042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32044         this_ptr_conv.is_owned = false;
32045         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
32046 }
32047
32048 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
32049         LDKChannelDetails this_ptr_conv;
32050         this_ptr_conv.inner = untag_ptr(this_ptr);
32051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32053         this_ptr_conv.is_owned = false;
32054         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
32055         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
32056         uint64_t ret_ref = tag_ptr(ret_copy, true);
32057         return ret_ref;
32058 }
32059
32060 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
32061         LDKChannelDetails this_ptr_conv;
32062         this_ptr_conv.inner = untag_ptr(this_ptr);
32063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32065         this_ptr_conv.is_owned = false;
32066         void* val_ptr = untag_ptr(val);
32067         CHECK_ACCESS(val_ptr);
32068         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
32069         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
32070         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
32071 }
32072
32073 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
32074         LDKChannelDetails this_ptr_conv;
32075         this_ptr_conv.inner = untag_ptr(this_ptr);
32076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32078         this_ptr_conv.is_owned = false;
32079         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
32080         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
32081         uint64_t ret_ref = tag_ptr(ret_copy, true);
32082         return ret_ref;
32083 }
32084
32085 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
32086         LDKChannelDetails this_ptr_conv;
32087         this_ptr_conv.inner = untag_ptr(this_ptr);
32088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32090         this_ptr_conv.is_owned = false;
32091         void* val_ptr = untag_ptr(val);
32092         CHECK_ACCESS(val_ptr);
32093         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
32094         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
32095         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
32096 }
32097
32098 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
32099         LDKChannelDetails this_ptr_conv;
32100         this_ptr_conv.inner = untag_ptr(this_ptr);
32101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32103         this_ptr_conv.is_owned = false;
32104         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
32105         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
32106         uint64_t ret_ref = tag_ptr(ret_copy, true);
32107         return ret_ref;
32108 }
32109
32110 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) {
32111         LDKChannelDetails this_ptr_conv;
32112         this_ptr_conv.inner = untag_ptr(this_ptr);
32113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32115         this_ptr_conv.is_owned = false;
32116         void* val_ptr = untag_ptr(val);
32117         CHECK_ACCESS(val_ptr);
32118         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
32119         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
32120         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
32121 }
32122
32123 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
32124         LDKChannelDetails this_ptr_conv;
32125         this_ptr_conv.inner = untag_ptr(this_ptr);
32126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32128         this_ptr_conv.is_owned = false;
32129         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
32130         return ret_conv;
32131 }
32132
32133 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
32134         LDKChannelDetails this_ptr_conv;
32135         this_ptr_conv.inner = untag_ptr(this_ptr);
32136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32138         this_ptr_conv.is_owned = false;
32139         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
32140 }
32141
32142 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
32143         LDKChannelDetails this_ptr_conv;
32144         this_ptr_conv.inner = untag_ptr(this_ptr);
32145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32147         this_ptr_conv.is_owned = false;
32148         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
32149         return ret_conv;
32150 }
32151
32152 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
32153         LDKChannelDetails this_ptr_conv;
32154         this_ptr_conv.inner = untag_ptr(this_ptr);
32155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32157         this_ptr_conv.is_owned = false;
32158         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
32159 }
32160
32161 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
32162         LDKChannelDetails this_ptr_conv;
32163         this_ptr_conv.inner = untag_ptr(this_ptr);
32164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32166         this_ptr_conv.is_owned = false;
32167         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
32168         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
32169         uint64_t ret_ref = tag_ptr(ret_copy, true);
32170         return ret_ref;
32171 }
32172
32173 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
32174         LDKChannelDetails this_ptr_conv;
32175         this_ptr_conv.inner = untag_ptr(this_ptr);
32176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32178         this_ptr_conv.is_owned = false;
32179         void* val_ptr = untag_ptr(val);
32180         CHECK_ACCESS(val_ptr);
32181         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
32182         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
32183         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
32184 }
32185
32186 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
32187         LDKChannelDetails this_ptr_conv;
32188         this_ptr_conv.inner = untag_ptr(this_ptr);
32189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32191         this_ptr_conv.is_owned = false;
32192         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
32193         return ret_conv;
32194 }
32195
32196 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
32197         LDKChannelDetails this_ptr_conv;
32198         this_ptr_conv.inner = untag_ptr(this_ptr);
32199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32201         this_ptr_conv.is_owned = false;
32202         ChannelDetails_set_is_usable(&this_ptr_conv, val);
32203 }
32204
32205 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
32206         LDKChannelDetails this_ptr_conv;
32207         this_ptr_conv.inner = untag_ptr(this_ptr);
32208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32210         this_ptr_conv.is_owned = false;
32211         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
32212         return ret_conv;
32213 }
32214
32215 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
32216         LDKChannelDetails this_ptr_conv;
32217         this_ptr_conv.inner = untag_ptr(this_ptr);
32218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32220         this_ptr_conv.is_owned = false;
32221         ChannelDetails_set_is_public(&this_ptr_conv, val);
32222 }
32223
32224 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
32225         LDKChannelDetails this_ptr_conv;
32226         this_ptr_conv.inner = untag_ptr(this_ptr);
32227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32229         this_ptr_conv.is_owned = false;
32230         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32231         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
32232         uint64_t ret_ref = tag_ptr(ret_copy, true);
32233         return ret_ref;
32234 }
32235
32236 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) {
32237         LDKChannelDetails this_ptr_conv;
32238         this_ptr_conv.inner = untag_ptr(this_ptr);
32239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32241         this_ptr_conv.is_owned = false;
32242         void* val_ptr = untag_ptr(val);
32243         CHECK_ACCESS(val_ptr);
32244         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32245         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32246         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
32247 }
32248
32249 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
32250         LDKChannelDetails this_ptr_conv;
32251         this_ptr_conv.inner = untag_ptr(this_ptr);
32252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32254         this_ptr_conv.is_owned = false;
32255         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32256         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
32257         uint64_t ret_ref = tag_ptr(ret_copy, true);
32258         return ret_ref;
32259 }
32260
32261 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) {
32262         LDKChannelDetails this_ptr_conv;
32263         this_ptr_conv.inner = untag_ptr(this_ptr);
32264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32266         this_ptr_conv.is_owned = false;
32267         void* val_ptr = untag_ptr(val);
32268         CHECK_ACCESS(val_ptr);
32269         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32270         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32271         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
32272 }
32273
32274 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
32275         LDKChannelDetails this_ptr_conv;
32276         this_ptr_conv.inner = untag_ptr(this_ptr);
32277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32279         this_ptr_conv.is_owned = false;
32280         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
32281         uint64_t ret_ref = 0;
32282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32284         return ret_ref;
32285 }
32286
32287 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
32288         LDKChannelDetails this_ptr_conv;
32289         this_ptr_conv.inner = untag_ptr(this_ptr);
32290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32292         this_ptr_conv.is_owned = false;
32293         LDKChannelConfig val_conv;
32294         val_conv.inner = untag_ptr(val);
32295         val_conv.is_owned = ptr_is_owned(val);
32296         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32297         val_conv = ChannelConfig_clone(&val_conv);
32298         ChannelDetails_set_config(&this_ptr_conv, val_conv);
32299 }
32300
32301 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) {
32302         LDKThirtyTwoBytes channel_id_arg_ref;
32303         CHECK(channel_id_arg->arr_len == 32);
32304         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32305         LDKChannelCounterparty counterparty_arg_conv;
32306         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
32307         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
32308         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
32309         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
32310         LDKOutPoint funding_txo_arg_conv;
32311         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
32312         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
32313         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
32314         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
32315         LDKChannelTypeFeatures channel_type_arg_conv;
32316         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
32317         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
32318         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
32319         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
32320         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
32321         CHECK_ACCESS(short_channel_id_arg_ptr);
32322         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
32323         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
32324         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
32325         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
32326         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
32327         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
32328         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
32329         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
32330         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
32331         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
32332         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
32333         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
32334         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
32335         LDKU128 user_channel_id_arg_ref;
32336         CHECK(user_channel_id_arg->arr_len == 16);
32337         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
32338         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
32339         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
32340         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
32341         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
32342         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
32343         CHECK_ACCESS(confirmations_required_arg_ptr);
32344         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
32345         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
32346         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
32347         CHECK_ACCESS(confirmations_arg_ptr);
32348         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
32349         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
32350         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
32351         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
32352         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
32353         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
32354         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
32355         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
32356         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
32357         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
32358         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
32359         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
32360         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
32361         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
32362         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
32363         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
32364         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
32365         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
32366         LDKChannelConfig config_arg_conv;
32367         config_arg_conv.inner = untag_ptr(config_arg);
32368         config_arg_conv.is_owned = ptr_is_owned(config_arg);
32369         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
32370         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
32371         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);
32372         uint64_t ret_ref = 0;
32373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32375         return ret_ref;
32376 }
32377
32378 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
32379         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
32380         uint64_t ret_ref = 0;
32381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32383         return ret_ref;
32384 }
32385 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
32386         LDKChannelDetails arg_conv;
32387         arg_conv.inner = untag_ptr(arg);
32388         arg_conv.is_owned = ptr_is_owned(arg);
32389         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32390         arg_conv.is_owned = false;
32391         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
32392         return ret_conv;
32393 }
32394
32395 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
32396         LDKChannelDetails orig_conv;
32397         orig_conv.inner = untag_ptr(orig);
32398         orig_conv.is_owned = ptr_is_owned(orig);
32399         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32400         orig_conv.is_owned = false;
32401         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
32402         uint64_t ret_ref = 0;
32403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32405         return ret_ref;
32406 }
32407
32408 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
32409         LDKChannelDetails this_arg_conv;
32410         this_arg_conv.inner = untag_ptr(this_arg);
32411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32413         this_arg_conv.is_owned = false;
32414         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32415         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
32416         uint64_t ret_ref = tag_ptr(ret_copy, true);
32417         return ret_ref;
32418 }
32419
32420 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
32421         LDKChannelDetails this_arg_conv;
32422         this_arg_conv.inner = untag_ptr(this_arg);
32423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32425         this_arg_conv.is_owned = false;
32426         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32427         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
32428         uint64_t ret_ref = tag_ptr(ret_copy, true);
32429         return ret_ref;
32430 }
32431
32432 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
32433         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
32434         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
32435         return ret_conv;
32436 }
32437
32438 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
32439         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
32440         return ret_conv;
32441 }
32442
32443 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
32444         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
32445         return ret_conv;
32446 }
32447
32448 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
32449         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
32450         return ret_conv;
32451 }
32452
32453 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
32454         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
32455         return ret_conv;
32456 }
32457
32458 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
32459         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
32460         return ret_conv;
32461 }
32462
32463 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
32464         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
32465         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
32466         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
32467         return ret_conv;
32468 }
32469
32470 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
32471         if (!ptr_is_owned(this_ptr)) return;
32472         void* this_ptr_ptr = untag_ptr(this_ptr);
32473         CHECK_ACCESS(this_ptr_ptr);
32474         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
32475         FREE(untag_ptr(this_ptr));
32476         RecentPaymentDetails_free(this_ptr_conv);
32477 }
32478
32479 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
32480         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32481         *ret_copy = RecentPaymentDetails_clone(arg);
32482         uint64_t ret_ref = tag_ptr(ret_copy, true);
32483         return ret_ref;
32484 }
32485 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
32486         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
32487         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
32488         return ret_conv;
32489 }
32490
32491 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
32492         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
32493         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32494         *ret_copy = RecentPaymentDetails_clone(orig_conv);
32495         uint64_t ret_ref = tag_ptr(ret_copy, true);
32496         return ret_ref;
32497 }
32498
32499 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) {
32500         LDKThirtyTwoBytes payment_hash_ref;
32501         CHECK(payment_hash->arr_len == 32);
32502         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32503         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32504         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
32505         uint64_t ret_ref = tag_ptr(ret_copy, true);
32506         return ret_ref;
32507 }
32508
32509 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(uint64_t payment_hash) {
32510         void* payment_hash_ptr = untag_ptr(payment_hash);
32511         CHECK_ACCESS(payment_hash_ptr);
32512         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
32513         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
32514         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32515         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_conv);
32516         uint64_t ret_ref = tag_ptr(ret_copy, true);
32517         return ret_ref;
32518 }
32519
32520 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) {
32521         LDKThirtyTwoBytes payment_hash_ref;
32522         CHECK(payment_hash->arr_len == 32);
32523         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32524         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32525         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
32526         uint64_t ret_ref = tag_ptr(ret_copy, true);
32527         return ret_ref;
32528 }
32529
32530 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
32531         LDKPhantomRouteHints this_obj_conv;
32532         this_obj_conv.inner = untag_ptr(this_obj);
32533         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32535         PhantomRouteHints_free(this_obj_conv);
32536 }
32537
32538 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
32539         LDKPhantomRouteHints this_ptr_conv;
32540         this_ptr_conv.inner = untag_ptr(this_ptr);
32541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32543         this_ptr_conv.is_owned = false;
32544         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
32545         uint64_tArray ret_arr = NULL;
32546         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32547         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32548         for (size_t q = 0; q < ret_var.datalen; q++) {
32549                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32550                 uint64_t ret_conv_16_ref = 0;
32551                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32552                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32553                 ret_arr_ptr[q] = ret_conv_16_ref;
32554         }
32555         
32556         FREE(ret_var.data);
32557         return ret_arr;
32558 }
32559
32560 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
32561         LDKPhantomRouteHints this_ptr_conv;
32562         this_ptr_conv.inner = untag_ptr(this_ptr);
32563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32565         this_ptr_conv.is_owned = false;
32566         LDKCVec_ChannelDetailsZ val_constr;
32567         val_constr.datalen = val->arr_len;
32568         if (val_constr.datalen > 0)
32569                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
32570         else
32571                 val_constr.data = NULL;
32572         uint64_t* val_vals = val->elems;
32573         for (size_t q = 0; q < val_constr.datalen; q++) {
32574                 uint64_t val_conv_16 = val_vals[q];
32575                 LDKChannelDetails val_conv_16_conv;
32576                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
32577                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
32578                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
32579                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
32580                 val_constr.data[q] = val_conv_16_conv;
32581         }
32582         FREE(val);
32583         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
32584 }
32585
32586 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
32587         LDKPhantomRouteHints this_ptr_conv;
32588         this_ptr_conv.inner = untag_ptr(this_ptr);
32589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32591         this_ptr_conv.is_owned = false;
32592         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
32593         return ret_conv;
32594 }
32595
32596 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
32597         LDKPhantomRouteHints this_ptr_conv;
32598         this_ptr_conv.inner = untag_ptr(this_ptr);
32599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32601         this_ptr_conv.is_owned = false;
32602         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
32603 }
32604
32605 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
32606         LDKPhantomRouteHints this_ptr_conv;
32607         this_ptr_conv.inner = untag_ptr(this_ptr);
32608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32610         this_ptr_conv.is_owned = false;
32611         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32612         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
32613         return ret_arr;
32614 }
32615
32616 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
32617         LDKPhantomRouteHints this_ptr_conv;
32618         this_ptr_conv.inner = untag_ptr(this_ptr);
32619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32621         this_ptr_conv.is_owned = false;
32622         LDKPublicKey val_ref;
32623         CHECK(val->arr_len == 33);
32624         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32625         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
32626 }
32627
32628 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) {
32629         LDKCVec_ChannelDetailsZ channels_arg_constr;
32630         channels_arg_constr.datalen = channels_arg->arr_len;
32631         if (channels_arg_constr.datalen > 0)
32632                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
32633         else
32634                 channels_arg_constr.data = NULL;
32635         uint64_t* channels_arg_vals = channels_arg->elems;
32636         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
32637                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
32638                 LDKChannelDetails channels_arg_conv_16_conv;
32639                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
32640                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
32641                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
32642                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
32643                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
32644         }
32645         FREE(channels_arg);
32646         LDKPublicKey real_node_pubkey_arg_ref;
32647         CHECK(real_node_pubkey_arg->arr_len == 33);
32648         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
32649         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
32650         uint64_t ret_ref = 0;
32651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32653         return ret_ref;
32654 }
32655
32656 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
32657         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
32658         uint64_t ret_ref = 0;
32659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32661         return ret_ref;
32662 }
32663 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
32664         LDKPhantomRouteHints arg_conv;
32665         arg_conv.inner = untag_ptr(arg);
32666         arg_conv.is_owned = ptr_is_owned(arg);
32667         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32668         arg_conv.is_owned = false;
32669         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
32670         return ret_conv;
32671 }
32672
32673 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
32674         LDKPhantomRouteHints orig_conv;
32675         orig_conv.inner = untag_ptr(orig);
32676         orig_conv.is_owned = ptr_is_owned(orig);
32677         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32678         orig_conv.is_owned = false;
32679         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
32680         uint64_t ret_ref = 0;
32681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32683         return ret_ref;
32684 }
32685
32686 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) {
32687         void* fee_est_ptr = untag_ptr(fee_est);
32688         CHECK_ACCESS(fee_est_ptr);
32689         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
32690         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
32691                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32692                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
32693         }
32694         void* chain_monitor_ptr = untag_ptr(chain_monitor);
32695         CHECK_ACCESS(chain_monitor_ptr);
32696         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
32697         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
32698                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32699                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
32700         }
32701         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
32702         CHECK_ACCESS(tx_broadcaster_ptr);
32703         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
32704         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32705                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32706                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
32707         }
32708         void* router_ptr = untag_ptr(router);
32709         CHECK_ACCESS(router_ptr);
32710         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
32711         if (router_conv.free == LDKRouter_JCalls_free) {
32712                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32713                 LDKRouter_JCalls_cloned(&router_conv);
32714         }
32715         void* logger_ptr = untag_ptr(logger);
32716         CHECK_ACCESS(logger_ptr);
32717         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32718         if (logger_conv.free == LDKLogger_JCalls_free) {
32719                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32720                 LDKLogger_JCalls_cloned(&logger_conv);
32721         }
32722         void* entropy_source_ptr = untag_ptr(entropy_source);
32723         CHECK_ACCESS(entropy_source_ptr);
32724         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32725         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32726                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32727                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32728         }
32729         void* node_signer_ptr = untag_ptr(node_signer);
32730         CHECK_ACCESS(node_signer_ptr);
32731         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
32732         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
32733                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32734                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
32735         }
32736         void* signer_provider_ptr = untag_ptr(signer_provider);
32737         CHECK_ACCESS(signer_provider_ptr);
32738         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32739         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32740                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32741                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32742         }
32743         LDKUserConfig config_conv;
32744         config_conv.inner = untag_ptr(config);
32745         config_conv.is_owned = ptr_is_owned(config);
32746         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
32747         config_conv = UserConfig_clone(&config_conv);
32748         LDKChainParameters params_conv;
32749         params_conv.inner = untag_ptr(params);
32750         params_conv.is_owned = ptr_is_owned(params);
32751         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
32752         params_conv = ChainParameters_clone(&params_conv);
32753         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);
32754         uint64_t ret_ref = 0;
32755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32757         return ret_ref;
32758 }
32759
32760 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
32761         LDKChannelManager this_arg_conv;
32762         this_arg_conv.inner = untag_ptr(this_arg);
32763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32765         this_arg_conv.is_owned = false;
32766         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
32767         uint64_t ret_ref = 0;
32768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32770         return ret_ref;
32771 }
32772
32773 uint64_t  __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int8_tArray user_channel_id, uint64_t override_config) {
32774         LDKChannelManager this_arg_conv;
32775         this_arg_conv.inner = untag_ptr(this_arg);
32776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32778         this_arg_conv.is_owned = false;
32779         LDKPublicKey their_network_key_ref;
32780         CHECK(their_network_key->arr_len == 33);
32781         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
32782         LDKU128 user_channel_id_ref;
32783         CHECK(user_channel_id->arr_len == 16);
32784         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
32785         LDKUserConfig override_config_conv;
32786         override_config_conv.inner = untag_ptr(override_config);
32787         override_config_conv.is_owned = ptr_is_owned(override_config);
32788         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
32789         override_config_conv = UserConfig_clone(&override_config_conv);
32790         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
32791         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
32792         return tag_ptr(ret_conv, true);
32793 }
32794
32795 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
32796         LDKChannelManager this_arg_conv;
32797         this_arg_conv.inner = untag_ptr(this_arg);
32798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32800         this_arg_conv.is_owned = false;
32801         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
32802         uint64_tArray ret_arr = NULL;
32803         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32804         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32805         for (size_t q = 0; q < ret_var.datalen; q++) {
32806                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32807                 uint64_t ret_conv_16_ref = 0;
32808                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32809                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32810                 ret_arr_ptr[q] = ret_conv_16_ref;
32811         }
32812         
32813         FREE(ret_var.data);
32814         return ret_arr;
32815 }
32816
32817 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
32818         LDKChannelManager this_arg_conv;
32819         this_arg_conv.inner = untag_ptr(this_arg);
32820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32822         this_arg_conv.is_owned = false;
32823         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
32824         uint64_tArray ret_arr = NULL;
32825         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32826         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32827         for (size_t q = 0; q < ret_var.datalen; q++) {
32828                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32829                 uint64_t ret_conv_16_ref = 0;
32830                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32831                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32832                 ret_arr_ptr[q] = ret_conv_16_ref;
32833         }
32834         
32835         FREE(ret_var.data);
32836         return ret_arr;
32837 }
32838
32839 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) {
32840         LDKChannelManager this_arg_conv;
32841         this_arg_conv.inner = untag_ptr(this_arg);
32842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32844         this_arg_conv.is_owned = false;
32845         LDKPublicKey counterparty_node_id_ref;
32846         CHECK(counterparty_node_id->arr_len == 33);
32847         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32848         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
32849         uint64_tArray ret_arr = NULL;
32850         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32851         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32852         for (size_t q = 0; q < ret_var.datalen; q++) {
32853                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32854                 uint64_t ret_conv_16_ref = 0;
32855                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32856                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32857                 ret_arr_ptr[q] = ret_conv_16_ref;
32858         }
32859         
32860         FREE(ret_var.data);
32861         return ret_arr;
32862 }
32863
32864 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
32865         LDKChannelManager this_arg_conv;
32866         this_arg_conv.inner = untag_ptr(this_arg);
32867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32869         this_arg_conv.is_owned = false;
32870         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
32871         uint64_tArray ret_arr = NULL;
32872         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32873         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32874         for (size_t w = 0; w < ret_var.datalen; w++) {
32875                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32876                 *ret_conv_22_copy = ret_var.data[w];
32877                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
32878                 ret_arr_ptr[w] = ret_conv_22_ref;
32879         }
32880         
32881         FREE(ret_var.data);
32882         return ret_arr;
32883 }
32884
32885 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) {
32886         LDKChannelManager this_arg_conv;
32887         this_arg_conv.inner = untag_ptr(this_arg);
32888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32890         this_arg_conv.is_owned = false;
32891         uint8_t channel_id_arr[32];
32892         CHECK(channel_id->arr_len == 32);
32893         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
32894         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
32895         LDKPublicKey counterparty_node_id_ref;
32896         CHECK(counterparty_node_id->arr_len == 33);
32897         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32898         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32899         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
32900         return tag_ptr(ret_conv, true);
32901 }
32902
32903 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) {
32904         LDKChannelManager this_arg_conv;
32905         this_arg_conv.inner = untag_ptr(this_arg);
32906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32908         this_arg_conv.is_owned = false;
32909         uint8_t channel_id_arr[32];
32910         CHECK(channel_id->arr_len == 32);
32911         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
32912         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
32913         LDKPublicKey counterparty_node_id_ref;
32914         CHECK(counterparty_node_id->arr_len == 33);
32915         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32916         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
32917         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
32918         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
32919         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
32920         LDKShutdownScript shutdown_script_conv;
32921         shutdown_script_conv.inner = untag_ptr(shutdown_script);
32922         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
32923         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
32924         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
32925         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32926         *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);
32927         return tag_ptr(ret_conv, true);
32928 }
32929
32930 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) {
32931         LDKChannelManager this_arg_conv;
32932         this_arg_conv.inner = untag_ptr(this_arg);
32933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32935         this_arg_conv.is_owned = false;
32936         uint8_t channel_id_arr[32];
32937         CHECK(channel_id->arr_len == 32);
32938         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
32939         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
32940         LDKPublicKey counterparty_node_id_ref;
32941         CHECK(counterparty_node_id->arr_len == 33);
32942         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32943         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32944         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
32945         return tag_ptr(ret_conv, true);
32946 }
32947
32948 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) {
32949         LDKChannelManager this_arg_conv;
32950         this_arg_conv.inner = untag_ptr(this_arg);
32951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32953         this_arg_conv.is_owned = false;
32954         uint8_t channel_id_arr[32];
32955         CHECK(channel_id->arr_len == 32);
32956         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
32957         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
32958         LDKPublicKey counterparty_node_id_ref;
32959         CHECK(counterparty_node_id->arr_len == 33);
32960         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32961         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32962         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
32963         return tag_ptr(ret_conv, true);
32964 }
32965
32966 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) {
32967         LDKChannelManager this_arg_conv;
32968         this_arg_conv.inner = untag_ptr(this_arg);
32969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32971         this_arg_conv.is_owned = false;
32972         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
32973 }
32974
32975 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) {
32976         LDKChannelManager this_arg_conv;
32977         this_arg_conv.inner = untag_ptr(this_arg);
32978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32980         this_arg_conv.is_owned = false;
32981         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
32982 }
32983
32984 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) {
32985         LDKChannelManager this_arg_conv;
32986         this_arg_conv.inner = untag_ptr(this_arg);
32987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32989         this_arg_conv.is_owned = false;
32990         LDKRoute route_conv;
32991         route_conv.inner = untag_ptr(route);
32992         route_conv.is_owned = ptr_is_owned(route);
32993         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
32994         route_conv.is_owned = false;
32995         LDKThirtyTwoBytes payment_hash_ref;
32996         CHECK(payment_hash->arr_len == 32);
32997         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32998         LDKRecipientOnionFields recipient_onion_conv;
32999         recipient_onion_conv.inner = untag_ptr(recipient_onion);
33000         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
33001         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
33002         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
33003         LDKThirtyTwoBytes payment_id_ref;
33004         CHECK(payment_id->arr_len == 32);
33005         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33006         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
33007         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
33008         return tag_ptr(ret_conv, true);
33009 }
33010
33011 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) {
33012         LDKChannelManager this_arg_conv;
33013         this_arg_conv.inner = untag_ptr(this_arg);
33014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33016         this_arg_conv.is_owned = false;
33017         LDKThirtyTwoBytes payment_hash_ref;
33018         CHECK(payment_hash->arr_len == 32);
33019         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
33020         LDKRecipientOnionFields recipient_onion_conv;
33021         recipient_onion_conv.inner = untag_ptr(recipient_onion);
33022         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
33023         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
33024         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
33025         LDKThirtyTwoBytes payment_id_ref;
33026         CHECK(payment_id->arr_len == 32);
33027         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33028         LDKRouteParameters route_params_conv;
33029         route_params_conv.inner = untag_ptr(route_params);
33030         route_params_conv.is_owned = ptr_is_owned(route_params);
33031         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
33032         route_params_conv = RouteParameters_clone(&route_params_conv);
33033         void* retry_strategy_ptr = untag_ptr(retry_strategy);
33034         CHECK_ACCESS(retry_strategy_ptr);
33035         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
33036         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
33037         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
33038         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
33039         return tag_ptr(ret_conv, true);
33040 }
33041
33042 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
33043         LDKChannelManager this_arg_conv;
33044         this_arg_conv.inner = untag_ptr(this_arg);
33045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33047         this_arg_conv.is_owned = false;
33048         LDKThirtyTwoBytes payment_id_ref;
33049         CHECK(payment_id->arr_len == 32);
33050         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33051         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
33052 }
33053
33054 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) {
33055         LDKChannelManager this_arg_conv;
33056         this_arg_conv.inner = untag_ptr(this_arg);
33057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33059         this_arg_conv.is_owned = false;
33060         LDKRoute route_conv;
33061         route_conv.inner = untag_ptr(route);
33062         route_conv.is_owned = ptr_is_owned(route);
33063         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
33064         route_conv.is_owned = false;
33065         void* payment_preimage_ptr = untag_ptr(payment_preimage);
33066         CHECK_ACCESS(payment_preimage_ptr);
33067         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
33068         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
33069         LDKRecipientOnionFields recipient_onion_conv;
33070         recipient_onion_conv.inner = untag_ptr(recipient_onion);
33071         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
33072         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
33073         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
33074         LDKThirtyTwoBytes payment_id_ref;
33075         CHECK(payment_id->arr_len == 32);
33076         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33077         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
33078         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
33079         return tag_ptr(ret_conv, true);
33080 }
33081
33082 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) {
33083         LDKChannelManager this_arg_conv;
33084         this_arg_conv.inner = untag_ptr(this_arg);
33085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33087         this_arg_conv.is_owned = false;
33088         void* payment_preimage_ptr = untag_ptr(payment_preimage);
33089         CHECK_ACCESS(payment_preimage_ptr);
33090         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
33091         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
33092         LDKRecipientOnionFields recipient_onion_conv;
33093         recipient_onion_conv.inner = untag_ptr(recipient_onion);
33094         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
33095         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
33096         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
33097         LDKThirtyTwoBytes payment_id_ref;
33098         CHECK(payment_id->arr_len == 32);
33099         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33100         LDKRouteParameters route_params_conv;
33101         route_params_conv.inner = untag_ptr(route_params);
33102         route_params_conv.is_owned = ptr_is_owned(route_params);
33103         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
33104         route_params_conv = RouteParameters_clone(&route_params_conv);
33105         void* retry_strategy_ptr = untag_ptr(retry_strategy);
33106         CHECK_ACCESS(retry_strategy_ptr);
33107         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
33108         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
33109         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
33110         *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);
33111         return tag_ptr(ret_conv, true);
33112 }
33113
33114 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
33115         LDKChannelManager this_arg_conv;
33116         this_arg_conv.inner = untag_ptr(this_arg);
33117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33119         this_arg_conv.is_owned = false;
33120         LDKPath path_conv;
33121         path_conv.inner = untag_ptr(path);
33122         path_conv.is_owned = ptr_is_owned(path);
33123         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
33124         path_conv = Path_clone(&path_conv);
33125         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
33126         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
33127         return tag_ptr(ret_conv, true);
33128 }
33129
33130 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) {
33131         LDKChannelManager this_arg_conv;
33132         this_arg_conv.inner = untag_ptr(this_arg);
33133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33135         this_arg_conv.is_owned = false;
33136         uint8_t temporary_channel_id_arr[32];
33137         CHECK(temporary_channel_id->arr_len == 32);
33138         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
33139         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33140         LDKPublicKey counterparty_node_id_ref;
33141         CHECK(counterparty_node_id->arr_len == 33);
33142         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33143         LDKTransaction funding_transaction_ref;
33144         funding_transaction_ref.datalen = funding_transaction->arr_len;
33145         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
33146         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
33147         funding_transaction_ref.data_is_owned = true;
33148         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33149         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
33150         return tag_ptr(ret_conv, true);
33151 }
33152
33153 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) {
33154         LDKChannelManager this_arg_conv;
33155         this_arg_conv.inner = untag_ptr(this_arg);
33156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33158         this_arg_conv.is_owned = false;
33159         LDKPublicKey counterparty_node_id_ref;
33160         CHECK(counterparty_node_id->arr_len == 33);
33161         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33162         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
33163         channel_ids_constr.datalen = channel_ids->arr_len;
33164         if (channel_ids_constr.datalen > 0)
33165                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
33166         else
33167                 channel_ids_constr.data = NULL;
33168         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
33169         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
33170                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
33171                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
33172                 CHECK(channel_ids_conv_12->arr_len == 32);
33173                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
33174                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
33175         }
33176         FREE(channel_ids);
33177         LDKChannelConfigUpdate config_update_conv;
33178         config_update_conv.inner = untag_ptr(config_update);
33179         config_update_conv.is_owned = ptr_is_owned(config_update);
33180         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
33181         config_update_conv.is_owned = false;
33182         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33183         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
33184         return tag_ptr(ret_conv, true);
33185 }
33186
33187 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) {
33188         LDKChannelManager this_arg_conv;
33189         this_arg_conv.inner = untag_ptr(this_arg);
33190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33192         this_arg_conv.is_owned = false;
33193         LDKPublicKey counterparty_node_id_ref;
33194         CHECK(counterparty_node_id->arr_len == 33);
33195         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33196         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
33197         channel_ids_constr.datalen = channel_ids->arr_len;
33198         if (channel_ids_constr.datalen > 0)
33199                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
33200         else
33201                 channel_ids_constr.data = NULL;
33202         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
33203         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
33204                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
33205                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
33206                 CHECK(channel_ids_conv_12->arr_len == 32);
33207                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
33208                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
33209         }
33210         FREE(channel_ids);
33211         LDKChannelConfig config_conv;
33212         config_conv.inner = untag_ptr(config);
33213         config_conv.is_owned = ptr_is_owned(config);
33214         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
33215         config_conv.is_owned = false;
33216         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33217         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
33218         return tag_ptr(ret_conv, true);
33219 }
33220
33221 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) {
33222         LDKChannelManager this_arg_conv;
33223         this_arg_conv.inner = untag_ptr(this_arg);
33224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33226         this_arg_conv.is_owned = false;
33227         LDKThirtyTwoBytes intercept_id_ref;
33228         CHECK(intercept_id->arr_len == 32);
33229         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
33230         uint8_t next_hop_channel_id_arr[32];
33231         CHECK(next_hop_channel_id->arr_len == 32);
33232         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
33233         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
33234         LDKPublicKey next_node_id_ref;
33235         CHECK(next_node_id->arr_len == 33);
33236         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
33237         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33238         *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);
33239         return tag_ptr(ret_conv, true);
33240 }
33241
33242 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
33243         LDKChannelManager this_arg_conv;
33244         this_arg_conv.inner = untag_ptr(this_arg);
33245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33247         this_arg_conv.is_owned = false;
33248         LDKThirtyTwoBytes intercept_id_ref;
33249         CHECK(intercept_id->arr_len == 32);
33250         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
33251         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33252         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
33253         return tag_ptr(ret_conv, true);
33254 }
33255
33256 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
33257         LDKChannelManager this_arg_conv;
33258         this_arg_conv.inner = untag_ptr(this_arg);
33259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33261         this_arg_conv.is_owned = false;
33262         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
33263 }
33264
33265 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
33266         LDKChannelManager this_arg_conv;
33267         this_arg_conv.inner = untag_ptr(this_arg);
33268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33270         this_arg_conv.is_owned = false;
33271         ChannelManager_timer_tick_occurred(&this_arg_conv);
33272 }
33273
33274 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
33275         LDKChannelManager this_arg_conv;
33276         this_arg_conv.inner = untag_ptr(this_arg);
33277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33279         this_arg_conv.is_owned = false;
33280         uint8_t payment_hash_arr[32];
33281         CHECK(payment_hash->arr_len == 32);
33282         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
33283         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
33284         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
33285 }
33286
33287 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards_with_reason"))) TS_ChannelManager_fail_htlc_backwards_with_reason(uint64_t this_arg, int8_tArray payment_hash, uint32_t failure_code) {
33288         LDKChannelManager this_arg_conv;
33289         this_arg_conv.inner = untag_ptr(this_arg);
33290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33292         this_arg_conv.is_owned = false;
33293         uint8_t payment_hash_arr[32];
33294         CHECK(payment_hash->arr_len == 32);
33295         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
33296         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
33297         LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code);
33298         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
33299 }
33300
33301 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
33302         LDKChannelManager this_arg_conv;
33303         this_arg_conv.inner = untag_ptr(this_arg);
33304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33306         this_arg_conv.is_owned = false;
33307         LDKThirtyTwoBytes payment_preimage_ref;
33308         CHECK(payment_preimage->arr_len == 32);
33309         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
33310         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
33311 }
33312
33313 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
33314         LDKChannelManager this_arg_conv;
33315         this_arg_conv.inner = untag_ptr(this_arg);
33316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33318         this_arg_conv.is_owned = false;
33319         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33320         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
33321         return ret_arr;
33322 }
33323
33324 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) {
33325         LDKChannelManager this_arg_conv;
33326         this_arg_conv.inner = untag_ptr(this_arg);
33327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33329         this_arg_conv.is_owned = false;
33330         uint8_t temporary_channel_id_arr[32];
33331         CHECK(temporary_channel_id->arr_len == 32);
33332         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
33333         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33334         LDKPublicKey counterparty_node_id_ref;
33335         CHECK(counterparty_node_id->arr_len == 33);
33336         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33337         LDKU128 user_channel_id_ref;
33338         CHECK(user_channel_id->arr_len == 16);
33339         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
33340         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33341         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
33342         return tag_ptr(ret_conv, true);
33343 }
33344
33345 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) {
33346         LDKChannelManager this_arg_conv;
33347         this_arg_conv.inner = untag_ptr(this_arg);
33348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33350         this_arg_conv.is_owned = false;
33351         uint8_t temporary_channel_id_arr[32];
33352         CHECK(temporary_channel_id->arr_len == 32);
33353         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
33354         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33355         LDKPublicKey counterparty_node_id_ref;
33356         CHECK(counterparty_node_id->arr_len == 33);
33357         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33358         LDKU128 user_channel_id_ref;
33359         CHECK(user_channel_id->arr_len == 16);
33360         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
33361         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33362         *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);
33363         return tag_ptr(ret_conv, true);
33364 }
33365
33366 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) {
33367         LDKChannelManager this_arg_conv;
33368         this_arg_conv.inner = untag_ptr(this_arg);
33369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33371         this_arg_conv.is_owned = false;
33372         void* min_value_msat_ptr = untag_ptr(min_value_msat);
33373         CHECK_ACCESS(min_value_msat_ptr);
33374         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
33375         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
33376         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
33377         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
33378         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
33379         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
33380         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
33381         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
33382         return tag_ptr(ret_conv, true);
33383 }
33384
33385 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) {
33386         LDKChannelManager this_arg_conv;
33387         this_arg_conv.inner = untag_ptr(this_arg);
33388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33390         this_arg_conv.is_owned = false;
33391         LDKThirtyTwoBytes payment_hash_ref;
33392         CHECK(payment_hash->arr_len == 32);
33393         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
33394         void* min_value_msat_ptr = untag_ptr(min_value_msat);
33395         CHECK_ACCESS(min_value_msat_ptr);
33396         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
33397         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
33398         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
33399         CHECK_ACCESS(min_final_cltv_expiry_ptr);
33400         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
33401         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
33402         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
33403         *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);
33404         return tag_ptr(ret_conv, true);
33405 }
33406
33407 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) {
33408         LDKChannelManager this_arg_conv;
33409         this_arg_conv.inner = untag_ptr(this_arg);
33410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33412         this_arg_conv.is_owned = false;
33413         LDKThirtyTwoBytes payment_hash_ref;
33414         CHECK(payment_hash->arr_len == 32);
33415         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
33416         LDKThirtyTwoBytes payment_secret_ref;
33417         CHECK(payment_secret->arr_len == 32);
33418         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
33419         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
33420         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
33421         return tag_ptr(ret_conv, true);
33422 }
33423
33424 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
33425         LDKChannelManager this_arg_conv;
33426         this_arg_conv.inner = untag_ptr(this_arg);
33427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33429         this_arg_conv.is_owned = false;
33430         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
33431         return ret_conv;
33432 }
33433
33434 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
33435         LDKChannelManager this_arg_conv;
33436         this_arg_conv.inner = untag_ptr(this_arg);
33437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33439         this_arg_conv.is_owned = false;
33440         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
33441         uint64_t ret_ref = 0;
33442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33444         return ret_ref;
33445 }
33446
33447 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
33448         LDKChannelManager this_arg_conv;
33449         this_arg_conv.inner = untag_ptr(this_arg);
33450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33452         this_arg_conv.is_owned = false;
33453         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
33454         return ret_conv;
33455 }
33456
33457 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
33458         LDKChannelManager this_arg_conv;
33459         this_arg_conv.inner = untag_ptr(this_arg);
33460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33462         this_arg_conv.is_owned = false;
33463         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
33464         uint64_t ret_ref = 0;
33465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33467         return ret_ref;
33468 }
33469
33470 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
33471         LDKChannelManager this_arg_conv;
33472         this_arg_conv.inner = untag_ptr(this_arg);
33473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33475         this_arg_conv.is_owned = false;
33476         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33477         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
33478         return tag_ptr(ret_ret, true);
33479 }
33480
33481 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
33482         LDKChannelManager this_arg_conv;
33483         this_arg_conv.inner = untag_ptr(this_arg);
33484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33486         this_arg_conv.is_owned = false;
33487         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
33488         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
33489         return tag_ptr(ret_ret, true);
33490 }
33491
33492 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
33493         LDKChannelManager this_arg_conv;
33494         this_arg_conv.inner = untag_ptr(this_arg);
33495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33497         this_arg_conv.is_owned = false;
33498         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
33499         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
33500         return tag_ptr(ret_ret, true);
33501 }
33502
33503 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
33504         LDKChannelManager this_arg_conv;
33505         this_arg_conv.inner = untag_ptr(this_arg);
33506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33508         this_arg_conv.is_owned = false;
33509         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
33510         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
33511         return tag_ptr(ret_ret, true);
33512 }
33513
33514 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
33515         LDKChannelManager this_arg_conv;
33516         this_arg_conv.inner = untag_ptr(this_arg);
33517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33519         this_arg_conv.is_owned = false;
33520         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
33521         uint64_t ret_ref = 0;
33522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33524         return ret_ref;
33525 }
33526
33527 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
33528         LDKChannelManager this_arg_conv;
33529         this_arg_conv.inner = untag_ptr(this_arg);
33530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33532         this_arg_conv.is_owned = false;
33533         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
33534         uint64_t ret_ref = 0;
33535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33537         return ret_ref;
33538 }
33539
33540 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
33541         LDKChannelManager this_arg_conv;
33542         this_arg_conv.inner = untag_ptr(this_arg);
33543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33545         this_arg_conv.is_owned = false;
33546         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
33547         uint64_t ret_ref = 0;
33548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33550         return ret_ref;
33551 }
33552
33553 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
33554         LDKChannelManager this_arg_conv;
33555         this_arg_conv.inner = untag_ptr(this_arg);
33556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33558         this_arg_conv.is_owned = false;
33559         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
33560         uint64_t ret_ref = 0;
33561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33563         return ret_ref;
33564 }
33565
33566 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
33567         LDKChannelManager this_arg_conv;
33568         this_arg_conv.inner = untag_ptr(this_arg);
33569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33571         this_arg_conv.is_owned = false;
33572         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
33573         uint64_t ret_ref = 0;
33574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33576         return ret_ref;
33577 }
33578
33579 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
33580         LDKChannelManager this_arg_conv;
33581         this_arg_conv.inner = untag_ptr(this_arg);
33582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33584         this_arg_conv.is_owned = false;
33585         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_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 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
33593         LDKChannelManager this_arg_conv;
33594         this_arg_conv.inner = untag_ptr(this_arg);
33595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33597         this_arg_conv.is_owned = false;
33598         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33599         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
33600         return tag_ptr(ret_ret, true);
33601 }
33602
33603 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
33604         LDKUserConfig config_conv;
33605         config_conv.inner = untag_ptr(config);
33606         config_conv.is_owned = ptr_is_owned(config);
33607         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
33608         config_conv.is_owned = false;
33609         LDKInitFeatures ret_var = provided_init_features(&config_conv);
33610         uint64_t ret_ref = 0;
33611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33613         return ret_ref;
33614 }
33615
33616 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
33617         LDKCounterpartyForwardingInfo obj_conv;
33618         obj_conv.inner = untag_ptr(obj);
33619         obj_conv.is_owned = ptr_is_owned(obj);
33620         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33621         obj_conv.is_owned = false;
33622         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
33623         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33624         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33625         CVec_u8Z_free(ret_var);
33626         return ret_arr;
33627 }
33628
33629 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
33630         LDKu8slice ser_ref;
33631         ser_ref.datalen = ser->arr_len;
33632         ser_ref.data = ser->elems;
33633         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
33634         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
33635         FREE(ser);
33636         return tag_ptr(ret_conv, true);
33637 }
33638
33639 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
33640         LDKChannelCounterparty obj_conv;
33641         obj_conv.inner = untag_ptr(obj);
33642         obj_conv.is_owned = ptr_is_owned(obj);
33643         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33644         obj_conv.is_owned = false;
33645         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
33646         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33647         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33648         CVec_u8Z_free(ret_var);
33649         return ret_arr;
33650 }
33651
33652 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
33653         LDKu8slice ser_ref;
33654         ser_ref.datalen = ser->arr_len;
33655         ser_ref.data = ser->elems;
33656         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
33657         *ret_conv = ChannelCounterparty_read(ser_ref);
33658         FREE(ser);
33659         return tag_ptr(ret_conv, true);
33660 }
33661
33662 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
33663         LDKChannelDetails obj_conv;
33664         obj_conv.inner = untag_ptr(obj);
33665         obj_conv.is_owned = ptr_is_owned(obj);
33666         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33667         obj_conv.is_owned = false;
33668         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
33669         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33670         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33671         CVec_u8Z_free(ret_var);
33672         return ret_arr;
33673 }
33674
33675 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
33676         LDKu8slice ser_ref;
33677         ser_ref.datalen = ser->arr_len;
33678         ser_ref.data = ser->elems;
33679         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
33680         *ret_conv = ChannelDetails_read(ser_ref);
33681         FREE(ser);
33682         return tag_ptr(ret_conv, true);
33683 }
33684
33685 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
33686         LDKPhantomRouteHints obj_conv;
33687         obj_conv.inner = untag_ptr(obj);
33688         obj_conv.is_owned = ptr_is_owned(obj);
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33690         obj_conv.is_owned = false;
33691         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
33692         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33693         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33694         CVec_u8Z_free(ret_var);
33695         return ret_arr;
33696 }
33697
33698 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
33699         LDKu8slice ser_ref;
33700         ser_ref.datalen = ser->arr_len;
33701         ser_ref.data = ser->elems;
33702         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
33703         *ret_conv = PhantomRouteHints_read(ser_ref);
33704         FREE(ser);
33705         return tag_ptr(ret_conv, true);
33706 }
33707
33708 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
33709         LDKChannelManager obj_conv;
33710         obj_conv.inner = untag_ptr(obj);
33711         obj_conv.is_owned = ptr_is_owned(obj);
33712         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33713         obj_conv.is_owned = false;
33714         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
33715         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33716         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33717         CVec_u8Z_free(ret_var);
33718         return ret_arr;
33719 }
33720
33721 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
33722         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
33723         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
33724         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33725         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33726         CVec_u8Z_free(ret_var);
33727         return ret_arr;
33728 }
33729
33730 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
33731         LDKu8slice ser_ref;
33732         ser_ref.datalen = ser->arr_len;
33733         ser_ref.data = ser->elems;
33734         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
33735         *ret_conv = ChannelShutdownState_read(ser_ref);
33736         FREE(ser);
33737         return tag_ptr(ret_conv, true);
33738 }
33739
33740 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
33741         LDKChannelManagerReadArgs this_obj_conv;
33742         this_obj_conv.inner = untag_ptr(this_obj);
33743         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33745         ChannelManagerReadArgs_free(this_obj_conv);
33746 }
33747
33748 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
33749         LDKChannelManagerReadArgs this_ptr_conv;
33750         this_ptr_conv.inner = untag_ptr(this_ptr);
33751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33753         this_ptr_conv.is_owned = false;
33754         // WARNING: This object doesn't live past this scope, needs clone!
33755         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
33756         return ret_ret;
33757 }
33758
33759 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
33760         LDKChannelManagerReadArgs this_ptr_conv;
33761         this_ptr_conv.inner = untag_ptr(this_ptr);
33762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33764         this_ptr_conv.is_owned = false;
33765         void* val_ptr = untag_ptr(val);
33766         CHECK_ACCESS(val_ptr);
33767         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
33768         if (val_conv.free == LDKEntropySource_JCalls_free) {
33769                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33770                 LDKEntropySource_JCalls_cloned(&val_conv);
33771         }
33772         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
33773 }
33774
33775 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
33776         LDKChannelManagerReadArgs this_ptr_conv;
33777         this_ptr_conv.inner = untag_ptr(this_ptr);
33778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33780         this_ptr_conv.is_owned = false;
33781         // WARNING: This object doesn't live past this scope, needs clone!
33782         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
33783         return ret_ret;
33784 }
33785
33786 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
33787         LDKChannelManagerReadArgs this_ptr_conv;
33788         this_ptr_conv.inner = untag_ptr(this_ptr);
33789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33791         this_ptr_conv.is_owned = false;
33792         void* val_ptr = untag_ptr(val);
33793         CHECK_ACCESS(val_ptr);
33794         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
33795         if (val_conv.free == LDKNodeSigner_JCalls_free) {
33796                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33797                 LDKNodeSigner_JCalls_cloned(&val_conv);
33798         }
33799         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
33800 }
33801
33802 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
33803         LDKChannelManagerReadArgs this_ptr_conv;
33804         this_ptr_conv.inner = untag_ptr(this_ptr);
33805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33807         this_ptr_conv.is_owned = false;
33808         // WARNING: This object doesn't live past this scope, needs clone!
33809         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
33810         return ret_ret;
33811 }
33812
33813 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
33814         LDKChannelManagerReadArgs this_ptr_conv;
33815         this_ptr_conv.inner = untag_ptr(this_ptr);
33816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33818         this_ptr_conv.is_owned = false;
33819         void* val_ptr = untag_ptr(val);
33820         CHECK_ACCESS(val_ptr);
33821         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
33822         if (val_conv.free == LDKSignerProvider_JCalls_free) {
33823                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33824                 LDKSignerProvider_JCalls_cloned(&val_conv);
33825         }
33826         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
33827 }
33828
33829 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
33830         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
33836         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
33837         return ret_ret;
33838 }
33839
33840 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
33841         LDKChannelManagerReadArgs this_ptr_conv;
33842         this_ptr_conv.inner = untag_ptr(this_ptr);
33843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33845         this_ptr_conv.is_owned = false;
33846         void* val_ptr = untag_ptr(val);
33847         CHECK_ACCESS(val_ptr);
33848         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
33849         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
33850                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33851                 LDKFeeEstimator_JCalls_cloned(&val_conv);
33852         }
33853         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
33854 }
33855
33856 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
33857         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
33863         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
33864         return ret_ret;
33865 }
33866
33867 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
33868         LDKChannelManagerReadArgs this_ptr_conv;
33869         this_ptr_conv.inner = untag_ptr(this_ptr);
33870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33872         this_ptr_conv.is_owned = false;
33873         void* val_ptr = untag_ptr(val);
33874         CHECK_ACCESS(val_ptr);
33875         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
33876         if (val_conv.free == LDKWatch_JCalls_free) {
33877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33878                 LDKWatch_JCalls_cloned(&val_conv);
33879         }
33880         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
33881 }
33882
33883 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
33884         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
33890         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
33891         return ret_ret;
33892 }
33893
33894 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
33895         LDKChannelManagerReadArgs this_ptr_conv;
33896         this_ptr_conv.inner = untag_ptr(this_ptr);
33897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33899         this_ptr_conv.is_owned = false;
33900         void* val_ptr = untag_ptr(val);
33901         CHECK_ACCESS(val_ptr);
33902         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
33903         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
33904                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33905                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
33906         }
33907         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
33908 }
33909
33910 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
33911         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
33917         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
33918         return ret_ret;
33919 }
33920
33921 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
33922         LDKChannelManagerReadArgs this_ptr_conv;
33923         this_ptr_conv.inner = untag_ptr(this_ptr);
33924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33926         this_ptr_conv.is_owned = false;
33927         void* val_ptr = untag_ptr(val);
33928         CHECK_ACCESS(val_ptr);
33929         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
33930         if (val_conv.free == LDKRouter_JCalls_free) {
33931                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33932                 LDKRouter_JCalls_cloned(&val_conv);
33933         }
33934         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
33935 }
33936
33937 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
33938         LDKChannelManagerReadArgs this_ptr_conv;
33939         this_ptr_conv.inner = untag_ptr(this_ptr);
33940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33942         this_ptr_conv.is_owned = false;
33943         // WARNING: This object doesn't live past this scope, needs clone!
33944         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
33945         return ret_ret;
33946 }
33947
33948 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
33949         LDKChannelManagerReadArgs 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         void* val_ptr = untag_ptr(val);
33955         CHECK_ACCESS(val_ptr);
33956         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
33957         if (val_conv.free == LDKLogger_JCalls_free) {
33958                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33959                 LDKLogger_JCalls_cloned(&val_conv);
33960         }
33961         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
33962 }
33963
33964 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
33965         LDKChannelManagerReadArgs this_ptr_conv;
33966         this_ptr_conv.inner = untag_ptr(this_ptr);
33967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33969         this_ptr_conv.is_owned = false;
33970         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
33971         uint64_t ret_ref = 0;
33972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33974         return ret_ref;
33975 }
33976
33977 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
33978         LDKChannelManagerReadArgs 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         LDKUserConfig val_conv;
33984         val_conv.inner = untag_ptr(val);
33985         val_conv.is_owned = ptr_is_owned(val);
33986         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33987         val_conv = UserConfig_clone(&val_conv);
33988         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
33989 }
33990
33991 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) {
33992         void* entropy_source_ptr = untag_ptr(entropy_source);
33993         CHECK_ACCESS(entropy_source_ptr);
33994         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
33995         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
33996                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33997                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
33998         }
33999         void* node_signer_ptr = untag_ptr(node_signer);
34000         CHECK_ACCESS(node_signer_ptr);
34001         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
34002         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
34003                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34004                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
34005         }
34006         void* signer_provider_ptr = untag_ptr(signer_provider);
34007         CHECK_ACCESS(signer_provider_ptr);
34008         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34009         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34011                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34012         }
34013         void* fee_estimator_ptr = untag_ptr(fee_estimator);
34014         CHECK_ACCESS(fee_estimator_ptr);
34015         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
34016         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
34017                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34018                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
34019         }
34020         void* chain_monitor_ptr = untag_ptr(chain_monitor);
34021         CHECK_ACCESS(chain_monitor_ptr);
34022         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
34023         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
34024                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34025                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
34026         }
34027         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
34028         CHECK_ACCESS(tx_broadcaster_ptr);
34029         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
34030         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34031                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34032                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
34033         }
34034         void* router_ptr = untag_ptr(router);
34035         CHECK_ACCESS(router_ptr);
34036         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
34037         if (router_conv.free == LDKRouter_JCalls_free) {
34038                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34039                 LDKRouter_JCalls_cloned(&router_conv);
34040         }
34041         void* logger_ptr = untag_ptr(logger);
34042         CHECK_ACCESS(logger_ptr);
34043         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34044         if (logger_conv.free == LDKLogger_JCalls_free) {
34045                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34046                 LDKLogger_JCalls_cloned(&logger_conv);
34047         }
34048         LDKUserConfig default_config_conv;
34049         default_config_conv.inner = untag_ptr(default_config);
34050         default_config_conv.is_owned = ptr_is_owned(default_config);
34051         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
34052         default_config_conv = UserConfig_clone(&default_config_conv);
34053         LDKCVec_ChannelMonitorZ channel_monitors_constr;
34054         channel_monitors_constr.datalen = channel_monitors->arr_len;
34055         if (channel_monitors_constr.datalen > 0)
34056                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
34057         else
34058                 channel_monitors_constr.data = NULL;
34059         uint64_t* channel_monitors_vals = channel_monitors->elems;
34060         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
34061                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
34062                 LDKChannelMonitor channel_monitors_conv_16_conv;
34063                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
34064                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
34065                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
34066                 channel_monitors_conv_16_conv.is_owned = false;
34067                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
34068         }
34069         FREE(channel_monitors);
34070         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);
34071         uint64_t ret_ref = 0;
34072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34074         return ret_ref;
34075 }
34076
34077 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
34078         LDKu8slice ser_ref;
34079         ser_ref.datalen = ser->arr_len;
34080         ser_ref.data = ser->elems;
34081         LDKChannelManagerReadArgs arg_conv;
34082         arg_conv.inner = untag_ptr(arg);
34083         arg_conv.is_owned = ptr_is_owned(arg);
34084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34085         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
34086         
34087         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
34088         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
34089         FREE(ser);
34090         return tag_ptr(ret_conv, true);
34091 }
34092
34093 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
34094         LDKExpandedKey this_obj_conv;
34095         this_obj_conv.inner = untag_ptr(this_obj);
34096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34098         ExpandedKey_free(this_obj_conv);
34099 }
34100
34101 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
34102         uint8_t key_material_arr[32];
34103         CHECK(key_material->arr_len == 32);
34104         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
34105         uint8_t (*key_material_ref)[32] = &key_material_arr;
34106         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
34107         uint64_t ret_ref = 0;
34108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34110         return ret_ref;
34111 }
34112
34113 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) {
34114         LDKExpandedKey keys_conv;
34115         keys_conv.inner = untag_ptr(keys);
34116         keys_conv.is_owned = ptr_is_owned(keys);
34117         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34118         keys_conv.is_owned = false;
34119         void* min_value_msat_ptr = untag_ptr(min_value_msat);
34120         CHECK_ACCESS(min_value_msat_ptr);
34121         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
34122         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
34123         void* entropy_source_ptr = untag_ptr(entropy_source);
34124         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
34125         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
34126         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
34127         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
34128         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
34129         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
34130         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
34131         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
34132         return tag_ptr(ret_conv, true);
34133 }
34134
34135 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) {
34136         LDKExpandedKey keys_conv;
34137         keys_conv.inner = untag_ptr(keys);
34138         keys_conv.is_owned = ptr_is_owned(keys);
34139         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34140         keys_conv.is_owned = false;
34141         void* min_value_msat_ptr = untag_ptr(min_value_msat);
34142         CHECK_ACCESS(min_value_msat_ptr);
34143         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
34144         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
34145         LDKThirtyTwoBytes payment_hash_ref;
34146         CHECK(payment_hash->arr_len == 32);
34147         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34148         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
34149         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
34150         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
34151         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
34152         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
34153         *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);
34154         return tag_ptr(ret_conv, true);
34155 }
34156
34157 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
34158         if (!ptr_is_owned(this_ptr)) return;
34159         void* this_ptr_ptr = untag_ptr(this_ptr);
34160         CHECK_ACCESS(this_ptr_ptr);
34161         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
34162         FREE(untag_ptr(this_ptr));
34163         DecodeError_free(this_ptr_conv);
34164 }
34165
34166 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
34167         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34168         *ret_copy = DecodeError_clone(arg);
34169         uint64_t ret_ref = tag_ptr(ret_copy, true);
34170         return ret_ref;
34171 }
34172 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
34173         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
34174         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
34175         return ret_conv;
34176 }
34177
34178 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
34179         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
34180         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34181         *ret_copy = DecodeError_clone(orig_conv);
34182         uint64_t ret_ref = tag_ptr(ret_copy, true);
34183         return ret_ref;
34184 }
34185
34186 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
34187         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34188         *ret_copy = DecodeError_unknown_version();
34189         uint64_t ret_ref = tag_ptr(ret_copy, true);
34190         return ret_ref;
34191 }
34192
34193 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
34194         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34195         *ret_copy = DecodeError_unknown_required_feature();
34196         uint64_t ret_ref = tag_ptr(ret_copy, true);
34197         return ret_ref;
34198 }
34199
34200 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
34201         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34202         *ret_copy = DecodeError_invalid_value();
34203         uint64_t ret_ref = tag_ptr(ret_copy, true);
34204         return ret_ref;
34205 }
34206
34207 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
34208         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34209         *ret_copy = DecodeError_short_read();
34210         uint64_t ret_ref = tag_ptr(ret_copy, true);
34211         return ret_ref;
34212 }
34213
34214 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
34215         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34216         *ret_copy = DecodeError_bad_length_descriptor();
34217         uint64_t ret_ref = tag_ptr(ret_copy, true);
34218         return ret_ref;
34219 }
34220
34221 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
34222         LDKIOError a_conv = LDKIOError_from_js(a);
34223         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34224         *ret_copy = DecodeError_io(a_conv);
34225         uint64_t ret_ref = tag_ptr(ret_copy, true);
34226         return ret_ref;
34227 }
34228
34229 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
34230         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34231         *ret_copy = DecodeError_unsupported_compression();
34232         uint64_t ret_ref = tag_ptr(ret_copy, true);
34233         return ret_ref;
34234 }
34235
34236 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
34237         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
34238         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
34239         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
34240         return ret_conv;
34241 }
34242
34243 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
34244         LDKInit this_obj_conv;
34245         this_obj_conv.inner = untag_ptr(this_obj);
34246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34248         Init_free(this_obj_conv);
34249 }
34250
34251 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
34252         LDKInit this_ptr_conv;
34253         this_ptr_conv.inner = untag_ptr(this_ptr);
34254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34256         this_ptr_conv.is_owned = false;
34257         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
34258         uint64_t ret_ref = 0;
34259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34261         return ret_ref;
34262 }
34263
34264 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
34265         LDKInit this_ptr_conv;
34266         this_ptr_conv.inner = untag_ptr(this_ptr);
34267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34269         this_ptr_conv.is_owned = false;
34270         LDKInitFeatures val_conv;
34271         val_conv.inner = untag_ptr(val);
34272         val_conv.is_owned = ptr_is_owned(val);
34273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34274         val_conv = InitFeatures_clone(&val_conv);
34275         Init_set_features(&this_ptr_conv, val_conv);
34276 }
34277
34278 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
34279         LDKInit this_ptr_conv;
34280         this_ptr_conv.inner = untag_ptr(this_ptr);
34281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34283         this_ptr_conv.is_owned = false;
34284         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
34285         *ret_copy = Init_get_networks(&this_ptr_conv);
34286         uint64_t ret_ref = tag_ptr(ret_copy, true);
34287         return ret_ref;
34288 }
34289
34290 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
34291         LDKInit this_ptr_conv;
34292         this_ptr_conv.inner = untag_ptr(this_ptr);
34293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34295         this_ptr_conv.is_owned = false;
34296         void* val_ptr = untag_ptr(val);
34297         CHECK_ACCESS(val_ptr);
34298         LDKCOption_CVec_ChainHashZZ val_conv = *(LDKCOption_CVec_ChainHashZZ*)(val_ptr);
34299         val_conv = COption_CVec_ChainHashZZ_clone((LDKCOption_CVec_ChainHashZZ*)untag_ptr(val));
34300         Init_set_networks(&this_ptr_conv, val_conv);
34301 }
34302
34303 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
34304         LDKInit this_ptr_conv;
34305         this_ptr_conv.inner = untag_ptr(this_ptr);
34306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34308         this_ptr_conv.is_owned = false;
34309         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
34310         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
34311         uint64_t ret_ref = tag_ptr(ret_copy, true);
34312         return ret_ref;
34313 }
34314
34315 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
34316         LDKInit this_ptr_conv;
34317         this_ptr_conv.inner = untag_ptr(this_ptr);
34318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34320         this_ptr_conv.is_owned = false;
34321         void* val_ptr = untag_ptr(val);
34322         CHECK_ACCESS(val_ptr);
34323         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
34324         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
34325         Init_set_remote_network_address(&this_ptr_conv, val_conv);
34326 }
34327
34328 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) {
34329         LDKInitFeatures features_arg_conv;
34330         features_arg_conv.inner = untag_ptr(features_arg);
34331         features_arg_conv.is_owned = ptr_is_owned(features_arg);
34332         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
34333         features_arg_conv = InitFeatures_clone(&features_arg_conv);
34334         void* networks_arg_ptr = untag_ptr(networks_arg);
34335         CHECK_ACCESS(networks_arg_ptr);
34336         LDKCOption_CVec_ChainHashZZ networks_arg_conv = *(LDKCOption_CVec_ChainHashZZ*)(networks_arg_ptr);
34337         networks_arg_conv = COption_CVec_ChainHashZZ_clone((LDKCOption_CVec_ChainHashZZ*)untag_ptr(networks_arg));
34338         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
34339         CHECK_ACCESS(remote_network_address_arg_ptr);
34340         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
34341         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
34342         uint64_t ret_ref = 0;
34343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34345         return ret_ref;
34346 }
34347
34348 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
34349         LDKInit ret_var = Init_clone(arg);
34350         uint64_t ret_ref = 0;
34351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34353         return ret_ref;
34354 }
34355 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
34356         LDKInit arg_conv;
34357         arg_conv.inner = untag_ptr(arg);
34358         arg_conv.is_owned = ptr_is_owned(arg);
34359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34360         arg_conv.is_owned = false;
34361         int64_t ret_conv = Init_clone_ptr(&arg_conv);
34362         return ret_conv;
34363 }
34364
34365 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
34366         LDKInit orig_conv;
34367         orig_conv.inner = untag_ptr(orig);
34368         orig_conv.is_owned = ptr_is_owned(orig);
34369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34370         orig_conv.is_owned = false;
34371         LDKInit ret_var = Init_clone(&orig_conv);
34372         uint64_t ret_ref = 0;
34373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34375         return ret_ref;
34376 }
34377
34378 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
34379         LDKInit a_conv;
34380         a_conv.inner = untag_ptr(a);
34381         a_conv.is_owned = ptr_is_owned(a);
34382         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34383         a_conv.is_owned = false;
34384         LDKInit b_conv;
34385         b_conv.inner = untag_ptr(b);
34386         b_conv.is_owned = ptr_is_owned(b);
34387         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34388         b_conv.is_owned = false;
34389         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
34390         return ret_conv;
34391 }
34392
34393 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
34394         LDKErrorMessage this_obj_conv;
34395         this_obj_conv.inner = untag_ptr(this_obj);
34396         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34398         ErrorMessage_free(this_obj_conv);
34399 }
34400
34401 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
34402         LDKErrorMessage this_ptr_conv;
34403         this_ptr_conv.inner = untag_ptr(this_ptr);
34404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34406         this_ptr_conv.is_owned = false;
34407         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34408         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
34409         return ret_arr;
34410 }
34411
34412 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
34413         LDKErrorMessage this_ptr_conv;
34414         this_ptr_conv.inner = untag_ptr(this_ptr);
34415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34417         this_ptr_conv.is_owned = false;
34418         LDKThirtyTwoBytes val_ref;
34419         CHECK(val->arr_len == 32);
34420         memcpy(val_ref.data, val->elems, 32); FREE(val);
34421         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
34422 }
34423
34424 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
34425         LDKErrorMessage this_ptr_conv;
34426         this_ptr_conv.inner = untag_ptr(this_ptr);
34427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34429         this_ptr_conv.is_owned = false;
34430         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
34431         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
34432         Str_free(ret_str);
34433         return ret_conv;
34434 }
34435
34436 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
34437         LDKErrorMessage this_ptr_conv;
34438         this_ptr_conv.inner = untag_ptr(this_ptr);
34439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34441         this_ptr_conv.is_owned = false;
34442         LDKStr val_conv = str_ref_to_owned_c(val);
34443         ErrorMessage_set_data(&this_ptr_conv, val_conv);
34444 }
34445
34446 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
34447         LDKThirtyTwoBytes channel_id_arg_ref;
34448         CHECK(channel_id_arg->arr_len == 32);
34449         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
34450         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
34451         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
34452         uint64_t ret_ref = 0;
34453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34455         return ret_ref;
34456 }
34457
34458 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
34459         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
34460         uint64_t ret_ref = 0;
34461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34463         return ret_ref;
34464 }
34465 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
34466         LDKErrorMessage arg_conv;
34467         arg_conv.inner = untag_ptr(arg);
34468         arg_conv.is_owned = ptr_is_owned(arg);
34469         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34470         arg_conv.is_owned = false;
34471         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
34472         return ret_conv;
34473 }
34474
34475 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
34476         LDKErrorMessage orig_conv;
34477         orig_conv.inner = untag_ptr(orig);
34478         orig_conv.is_owned = ptr_is_owned(orig);
34479         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34480         orig_conv.is_owned = false;
34481         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
34482         uint64_t ret_ref = 0;
34483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34485         return ret_ref;
34486 }
34487
34488 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
34489         LDKErrorMessage a_conv;
34490         a_conv.inner = untag_ptr(a);
34491         a_conv.is_owned = ptr_is_owned(a);
34492         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34493         a_conv.is_owned = false;
34494         LDKErrorMessage b_conv;
34495         b_conv.inner = untag_ptr(b);
34496         b_conv.is_owned = ptr_is_owned(b);
34497         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34498         b_conv.is_owned = false;
34499         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
34500         return ret_conv;
34501 }
34502
34503 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
34504         LDKWarningMessage this_obj_conv;
34505         this_obj_conv.inner = untag_ptr(this_obj);
34506         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34508         WarningMessage_free(this_obj_conv);
34509 }
34510
34511 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
34512         LDKWarningMessage this_ptr_conv;
34513         this_ptr_conv.inner = untag_ptr(this_ptr);
34514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34516         this_ptr_conv.is_owned = false;
34517         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34518         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
34519         return ret_arr;
34520 }
34521
34522 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
34523         LDKWarningMessage this_ptr_conv;
34524         this_ptr_conv.inner = untag_ptr(this_ptr);
34525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34527         this_ptr_conv.is_owned = false;
34528         LDKThirtyTwoBytes val_ref;
34529         CHECK(val->arr_len == 32);
34530         memcpy(val_ref.data, val->elems, 32); FREE(val);
34531         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
34532 }
34533
34534 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
34535         LDKWarningMessage this_ptr_conv;
34536         this_ptr_conv.inner = untag_ptr(this_ptr);
34537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34539         this_ptr_conv.is_owned = false;
34540         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
34541         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
34542         Str_free(ret_str);
34543         return ret_conv;
34544 }
34545
34546 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
34547         LDKWarningMessage this_ptr_conv;
34548         this_ptr_conv.inner = untag_ptr(this_ptr);
34549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34551         this_ptr_conv.is_owned = false;
34552         LDKStr val_conv = str_ref_to_owned_c(val);
34553         WarningMessage_set_data(&this_ptr_conv, val_conv);
34554 }
34555
34556 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
34557         LDKThirtyTwoBytes channel_id_arg_ref;
34558         CHECK(channel_id_arg->arr_len == 32);
34559         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
34560         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
34561         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
34562         uint64_t ret_ref = 0;
34563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34565         return ret_ref;
34566 }
34567
34568 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
34569         LDKWarningMessage ret_var = WarningMessage_clone(arg);
34570         uint64_t ret_ref = 0;
34571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34573         return ret_ref;
34574 }
34575 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
34576         LDKWarningMessage arg_conv;
34577         arg_conv.inner = untag_ptr(arg);
34578         arg_conv.is_owned = ptr_is_owned(arg);
34579         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34580         arg_conv.is_owned = false;
34581         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
34582         return ret_conv;
34583 }
34584
34585 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
34586         LDKWarningMessage orig_conv;
34587         orig_conv.inner = untag_ptr(orig);
34588         orig_conv.is_owned = ptr_is_owned(orig);
34589         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34590         orig_conv.is_owned = false;
34591         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
34592         uint64_t ret_ref = 0;
34593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34595         return ret_ref;
34596 }
34597
34598 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
34599         LDKWarningMessage a_conv;
34600         a_conv.inner = untag_ptr(a);
34601         a_conv.is_owned = ptr_is_owned(a);
34602         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34603         a_conv.is_owned = false;
34604         LDKWarningMessage b_conv;
34605         b_conv.inner = untag_ptr(b);
34606         b_conv.is_owned = ptr_is_owned(b);
34607         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34608         b_conv.is_owned = false;
34609         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
34610         return ret_conv;
34611 }
34612
34613 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
34614         LDKPing this_obj_conv;
34615         this_obj_conv.inner = untag_ptr(this_obj);
34616         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34618         Ping_free(this_obj_conv);
34619 }
34620
34621 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
34622         LDKPing this_ptr_conv;
34623         this_ptr_conv.inner = untag_ptr(this_ptr);
34624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34626         this_ptr_conv.is_owned = false;
34627         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
34628         return ret_conv;
34629 }
34630
34631 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
34632         LDKPing this_ptr_conv;
34633         this_ptr_conv.inner = untag_ptr(this_ptr);
34634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34636         this_ptr_conv.is_owned = false;
34637         Ping_set_ponglen(&this_ptr_conv, val);
34638 }
34639
34640 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
34641         LDKPing this_ptr_conv;
34642         this_ptr_conv.inner = untag_ptr(this_ptr);
34643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34645         this_ptr_conv.is_owned = false;
34646         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
34647         return ret_conv;
34648 }
34649
34650 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
34651         LDKPing this_ptr_conv;
34652         this_ptr_conv.inner = untag_ptr(this_ptr);
34653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34655         this_ptr_conv.is_owned = false;
34656         Ping_set_byteslen(&this_ptr_conv, val);
34657 }
34658
34659 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
34660         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
34661         uint64_t ret_ref = 0;
34662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34664         return ret_ref;
34665 }
34666
34667 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
34668         LDKPing ret_var = Ping_clone(arg);
34669         uint64_t ret_ref = 0;
34670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34672         return ret_ref;
34673 }
34674 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
34675         LDKPing arg_conv;
34676         arg_conv.inner = untag_ptr(arg);
34677         arg_conv.is_owned = ptr_is_owned(arg);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34679         arg_conv.is_owned = false;
34680         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
34681         return ret_conv;
34682 }
34683
34684 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
34685         LDKPing orig_conv;
34686         orig_conv.inner = untag_ptr(orig);
34687         orig_conv.is_owned = ptr_is_owned(orig);
34688         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34689         orig_conv.is_owned = false;
34690         LDKPing ret_var = Ping_clone(&orig_conv);
34691         uint64_t ret_ref = 0;
34692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34694         return ret_ref;
34695 }
34696
34697 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
34698         LDKPing a_conv;
34699         a_conv.inner = untag_ptr(a);
34700         a_conv.is_owned = ptr_is_owned(a);
34701         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34702         a_conv.is_owned = false;
34703         LDKPing b_conv;
34704         b_conv.inner = untag_ptr(b);
34705         b_conv.is_owned = ptr_is_owned(b);
34706         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34707         b_conv.is_owned = false;
34708         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
34709         return ret_conv;
34710 }
34711
34712 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
34713         LDKPong this_obj_conv;
34714         this_obj_conv.inner = untag_ptr(this_obj);
34715         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34717         Pong_free(this_obj_conv);
34718 }
34719
34720 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
34721         LDKPong this_ptr_conv;
34722         this_ptr_conv.inner = untag_ptr(this_ptr);
34723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34725         this_ptr_conv.is_owned = false;
34726         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
34727         return ret_conv;
34728 }
34729
34730 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
34731         LDKPong this_ptr_conv;
34732         this_ptr_conv.inner = untag_ptr(this_ptr);
34733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34735         this_ptr_conv.is_owned = false;
34736         Pong_set_byteslen(&this_ptr_conv, val);
34737 }
34738
34739 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
34740         LDKPong ret_var = Pong_new(byteslen_arg);
34741         uint64_t ret_ref = 0;
34742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34744         return ret_ref;
34745 }
34746
34747 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
34748         LDKPong ret_var = Pong_clone(arg);
34749         uint64_t ret_ref = 0;
34750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34752         return ret_ref;
34753 }
34754 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
34755         LDKPong arg_conv;
34756         arg_conv.inner = untag_ptr(arg);
34757         arg_conv.is_owned = ptr_is_owned(arg);
34758         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34759         arg_conv.is_owned = false;
34760         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
34761         return ret_conv;
34762 }
34763
34764 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
34765         LDKPong orig_conv;
34766         orig_conv.inner = untag_ptr(orig);
34767         orig_conv.is_owned = ptr_is_owned(orig);
34768         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34769         orig_conv.is_owned = false;
34770         LDKPong ret_var = Pong_clone(&orig_conv);
34771         uint64_t ret_ref = 0;
34772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34774         return ret_ref;
34775 }
34776
34777 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
34778         LDKPong a_conv;
34779         a_conv.inner = untag_ptr(a);
34780         a_conv.is_owned = ptr_is_owned(a);
34781         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34782         a_conv.is_owned = false;
34783         LDKPong b_conv;
34784         b_conv.inner = untag_ptr(b);
34785         b_conv.is_owned = ptr_is_owned(b);
34786         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34787         b_conv.is_owned = false;
34788         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
34789         return ret_conv;
34790 }
34791
34792 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
34793         LDKOpenChannel this_obj_conv;
34794         this_obj_conv.inner = untag_ptr(this_obj);
34795         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34797         OpenChannel_free(this_obj_conv);
34798 }
34799
34800 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
34801         LDKOpenChannel this_ptr_conv;
34802         this_ptr_conv.inner = untag_ptr(this_ptr);
34803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34805         this_ptr_conv.is_owned = false;
34806         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34807         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
34808         return ret_arr;
34809 }
34810
34811 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34812         LDKOpenChannel this_ptr_conv;
34813         this_ptr_conv.inner = untag_ptr(this_ptr);
34814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34816         this_ptr_conv.is_owned = false;
34817         LDKThirtyTwoBytes val_ref;
34818         CHECK(val->arr_len == 32);
34819         memcpy(val_ref.data, val->elems, 32); FREE(val);
34820         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
34821 }
34822
34823 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
34824         LDKOpenChannel this_ptr_conv;
34825         this_ptr_conv.inner = untag_ptr(this_ptr);
34826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34828         this_ptr_conv.is_owned = false;
34829         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34830         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
34831         return ret_arr;
34832 }
34833
34834 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
34835         LDKOpenChannel this_ptr_conv;
34836         this_ptr_conv.inner = untag_ptr(this_ptr);
34837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34839         this_ptr_conv.is_owned = false;
34840         LDKThirtyTwoBytes val_ref;
34841         CHECK(val->arr_len == 32);
34842         memcpy(val_ref.data, val->elems, 32); FREE(val);
34843         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
34844 }
34845
34846 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
34847         LDKOpenChannel this_ptr_conv;
34848         this_ptr_conv.inner = untag_ptr(this_ptr);
34849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34851         this_ptr_conv.is_owned = false;
34852         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
34853         return ret_conv;
34854 }
34855
34856 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
34857         LDKOpenChannel this_ptr_conv;
34858         this_ptr_conv.inner = untag_ptr(this_ptr);
34859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34861         this_ptr_conv.is_owned = false;
34862         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
34863 }
34864
34865 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
34866         LDKOpenChannel this_ptr_conv;
34867         this_ptr_conv.inner = untag_ptr(this_ptr);
34868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34870         this_ptr_conv.is_owned = false;
34871         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
34872         return ret_conv;
34873 }
34874
34875 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
34876         LDKOpenChannel this_ptr_conv;
34877         this_ptr_conv.inner = untag_ptr(this_ptr);
34878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34880         this_ptr_conv.is_owned = false;
34881         OpenChannel_set_push_msat(&this_ptr_conv, val);
34882 }
34883
34884 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
34885         LDKOpenChannel this_ptr_conv;
34886         this_ptr_conv.inner = untag_ptr(this_ptr);
34887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34889         this_ptr_conv.is_owned = false;
34890         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
34891         return ret_conv;
34892 }
34893
34894 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
34895         LDKOpenChannel this_ptr_conv;
34896         this_ptr_conv.inner = untag_ptr(this_ptr);
34897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34899         this_ptr_conv.is_owned = false;
34900         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
34901 }
34902
34903 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) {
34904         LDKOpenChannel this_ptr_conv;
34905         this_ptr_conv.inner = untag_ptr(this_ptr);
34906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34908         this_ptr_conv.is_owned = false;
34909         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
34910         return ret_conv;
34911 }
34912
34913 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) {
34914         LDKOpenChannel this_ptr_conv;
34915         this_ptr_conv.inner = untag_ptr(this_ptr);
34916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34918         this_ptr_conv.is_owned = false;
34919         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
34920 }
34921
34922 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
34923         LDKOpenChannel this_ptr_conv;
34924         this_ptr_conv.inner = untag_ptr(this_ptr);
34925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34927         this_ptr_conv.is_owned = false;
34928         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
34929         return ret_conv;
34930 }
34931
34932 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
34933         LDKOpenChannel this_ptr_conv;
34934         this_ptr_conv.inner = untag_ptr(this_ptr);
34935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34937         this_ptr_conv.is_owned = false;
34938         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
34939 }
34940
34941 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
34942         LDKOpenChannel this_ptr_conv;
34943         this_ptr_conv.inner = untag_ptr(this_ptr);
34944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34946         this_ptr_conv.is_owned = false;
34947         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
34948         return ret_conv;
34949 }
34950
34951 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34952         LDKOpenChannel this_ptr_conv;
34953         this_ptr_conv.inner = untag_ptr(this_ptr);
34954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34956         this_ptr_conv.is_owned = false;
34957         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
34958 }
34959
34960 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
34961         LDKOpenChannel this_ptr_conv;
34962         this_ptr_conv.inner = untag_ptr(this_ptr);
34963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34965         this_ptr_conv.is_owned = false;
34966         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
34967         return ret_conv;
34968 }
34969
34970 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
34971         LDKOpenChannel this_ptr_conv;
34972         this_ptr_conv.inner = untag_ptr(this_ptr);
34973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34975         this_ptr_conv.is_owned = false;
34976         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
34977 }
34978
34979 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
34980         LDKOpenChannel this_ptr_conv;
34981         this_ptr_conv.inner = untag_ptr(this_ptr);
34982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34984         this_ptr_conv.is_owned = false;
34985         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
34986         return ret_conv;
34987 }
34988
34989 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
34990         LDKOpenChannel this_ptr_conv;
34991         this_ptr_conv.inner = untag_ptr(this_ptr);
34992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34994         this_ptr_conv.is_owned = false;
34995         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
34996 }
34997
34998 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
34999         LDKOpenChannel this_ptr_conv;
35000         this_ptr_conv.inner = untag_ptr(this_ptr);
35001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35003         this_ptr_conv.is_owned = false;
35004         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
35005         return ret_conv;
35006 }
35007
35008 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
35009         LDKOpenChannel this_ptr_conv;
35010         this_ptr_conv.inner = untag_ptr(this_ptr);
35011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35013         this_ptr_conv.is_owned = false;
35014         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
35015 }
35016
35017 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
35018         LDKOpenChannel this_ptr_conv;
35019         this_ptr_conv.inner = untag_ptr(this_ptr);
35020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35022         this_ptr_conv.is_owned = false;
35023         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35024         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
35025         return ret_arr;
35026 }
35027
35028 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
35029         LDKOpenChannel this_ptr_conv;
35030         this_ptr_conv.inner = untag_ptr(this_ptr);
35031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35033         this_ptr_conv.is_owned = false;
35034         LDKPublicKey val_ref;
35035         CHECK(val->arr_len == 33);
35036         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35037         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
35038 }
35039
35040 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
35041         LDKOpenChannel this_ptr_conv;
35042         this_ptr_conv.inner = untag_ptr(this_ptr);
35043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35045         this_ptr_conv.is_owned = false;
35046         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35047         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
35048         return ret_arr;
35049 }
35050
35051 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
35052         LDKOpenChannel this_ptr_conv;
35053         this_ptr_conv.inner = untag_ptr(this_ptr);
35054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35056         this_ptr_conv.is_owned = false;
35057         LDKPublicKey val_ref;
35058         CHECK(val->arr_len == 33);
35059         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35060         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
35061 }
35062
35063 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
35064         LDKOpenChannel this_ptr_conv;
35065         this_ptr_conv.inner = untag_ptr(this_ptr);
35066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35068         this_ptr_conv.is_owned = false;
35069         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35070         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
35071         return ret_arr;
35072 }
35073
35074 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
35075         LDKOpenChannel this_ptr_conv;
35076         this_ptr_conv.inner = untag_ptr(this_ptr);
35077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35079         this_ptr_conv.is_owned = false;
35080         LDKPublicKey val_ref;
35081         CHECK(val->arr_len == 33);
35082         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35083         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
35084 }
35085
35086 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
35087         LDKOpenChannel this_ptr_conv;
35088         this_ptr_conv.inner = untag_ptr(this_ptr);
35089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35091         this_ptr_conv.is_owned = false;
35092         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35093         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35094         return ret_arr;
35095 }
35096
35097 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
35098         LDKOpenChannel this_ptr_conv;
35099         this_ptr_conv.inner = untag_ptr(this_ptr);
35100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35102         this_ptr_conv.is_owned = false;
35103         LDKPublicKey val_ref;
35104         CHECK(val->arr_len == 33);
35105         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35106         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35107 }
35108
35109 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
35110         LDKOpenChannel this_ptr_conv;
35111         this_ptr_conv.inner = untag_ptr(this_ptr);
35112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35114         this_ptr_conv.is_owned = false;
35115         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35116         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
35117         return ret_arr;
35118 }
35119
35120 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
35121         LDKOpenChannel this_ptr_conv;
35122         this_ptr_conv.inner = untag_ptr(this_ptr);
35123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35125         this_ptr_conv.is_owned = false;
35126         LDKPublicKey val_ref;
35127         CHECK(val->arr_len == 33);
35128         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35129         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
35130 }
35131
35132 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
35133         LDKOpenChannel this_ptr_conv;
35134         this_ptr_conv.inner = untag_ptr(this_ptr);
35135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35137         this_ptr_conv.is_owned = false;
35138         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35139         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35140         return ret_arr;
35141 }
35142
35143 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) {
35144         LDKOpenChannel this_ptr_conv;
35145         this_ptr_conv.inner = untag_ptr(this_ptr);
35146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35148         this_ptr_conv.is_owned = false;
35149         LDKPublicKey val_ref;
35150         CHECK(val->arr_len == 33);
35151         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35152         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
35153 }
35154
35155 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
35156         LDKOpenChannel this_ptr_conv;
35157         this_ptr_conv.inner = untag_ptr(this_ptr);
35158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35160         this_ptr_conv.is_owned = false;
35161         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
35162         return ret_conv;
35163 }
35164
35165 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
35166         LDKOpenChannel this_ptr_conv;
35167         this_ptr_conv.inner = untag_ptr(this_ptr);
35168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35170         this_ptr_conv.is_owned = false;
35171         OpenChannel_set_channel_flags(&this_ptr_conv, val);
35172 }
35173
35174 uint64_t  __attribute__((export_name("TS_OpenChannel_get_shutdown_scriptpubkey"))) TS_OpenChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
35175         LDKOpenChannel this_ptr_conv;
35176         this_ptr_conv.inner = untag_ptr(this_ptr);
35177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35179         this_ptr_conv.is_owned = false;
35180         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
35181         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
35182         uint64_t ret_ref = tag_ptr(ret_copy, true);
35183         return ret_ref;
35184 }
35185
35186 void  __attribute__((export_name("TS_OpenChannel_set_shutdown_scriptpubkey"))) TS_OpenChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
35187         LDKOpenChannel this_ptr_conv;
35188         this_ptr_conv.inner = untag_ptr(this_ptr);
35189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35191         this_ptr_conv.is_owned = false;
35192         void* val_ptr = untag_ptr(val);
35193         CHECK_ACCESS(val_ptr);
35194         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
35195         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
35196         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
35197 }
35198
35199 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
35200         LDKOpenChannel this_ptr_conv;
35201         this_ptr_conv.inner = untag_ptr(this_ptr);
35202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35204         this_ptr_conv.is_owned = false;
35205         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
35206         uint64_t ret_ref = 0;
35207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35209         return ret_ref;
35210 }
35211
35212 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
35213         LDKOpenChannel this_ptr_conv;
35214         this_ptr_conv.inner = untag_ptr(this_ptr);
35215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35217         this_ptr_conv.is_owned = false;
35218         LDKChannelTypeFeatures val_conv;
35219         val_conv.inner = untag_ptr(val);
35220         val_conv.is_owned = ptr_is_owned(val);
35221         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35222         val_conv = ChannelTypeFeatures_clone(&val_conv);
35223         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
35224 }
35225
35226 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) {
35227         LDKThirtyTwoBytes chain_hash_arg_ref;
35228         CHECK(chain_hash_arg->arr_len == 32);
35229         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35230         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
35231         CHECK(temporary_channel_id_arg->arr_len == 32);
35232         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
35233         LDKPublicKey funding_pubkey_arg_ref;
35234         CHECK(funding_pubkey_arg->arr_len == 33);
35235         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
35236         LDKPublicKey revocation_basepoint_arg_ref;
35237         CHECK(revocation_basepoint_arg->arr_len == 33);
35238         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
35239         LDKPublicKey payment_point_arg_ref;
35240         CHECK(payment_point_arg->arr_len == 33);
35241         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
35242         LDKPublicKey delayed_payment_basepoint_arg_ref;
35243         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
35244         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
35245         LDKPublicKey htlc_basepoint_arg_ref;
35246         CHECK(htlc_basepoint_arg->arr_len == 33);
35247         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
35248         LDKPublicKey first_per_commitment_point_arg_ref;
35249         CHECK(first_per_commitment_point_arg->arr_len == 33);
35250         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
35251         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
35252         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
35253         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
35254         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
35255         LDKChannelTypeFeatures channel_type_arg_conv;
35256         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
35257         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
35258         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
35259         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
35260         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);
35261         uint64_t ret_ref = 0;
35262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35264         return ret_ref;
35265 }
35266
35267 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
35268         LDKOpenChannel ret_var = OpenChannel_clone(arg);
35269         uint64_t ret_ref = 0;
35270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35272         return ret_ref;
35273 }
35274 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
35275         LDKOpenChannel arg_conv;
35276         arg_conv.inner = untag_ptr(arg);
35277         arg_conv.is_owned = ptr_is_owned(arg);
35278         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35279         arg_conv.is_owned = false;
35280         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
35281         return ret_conv;
35282 }
35283
35284 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
35285         LDKOpenChannel orig_conv;
35286         orig_conv.inner = untag_ptr(orig);
35287         orig_conv.is_owned = ptr_is_owned(orig);
35288         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35289         orig_conv.is_owned = false;
35290         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
35291         uint64_t ret_ref = 0;
35292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35294         return ret_ref;
35295 }
35296
35297 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
35298         LDKOpenChannel a_conv;
35299         a_conv.inner = untag_ptr(a);
35300         a_conv.is_owned = ptr_is_owned(a);
35301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35302         a_conv.is_owned = false;
35303         LDKOpenChannel b_conv;
35304         b_conv.inner = untag_ptr(b);
35305         b_conv.is_owned = ptr_is_owned(b);
35306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35307         b_conv.is_owned = false;
35308         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
35309         return ret_conv;
35310 }
35311
35312 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
35313         LDKOpenChannelV2 this_obj_conv;
35314         this_obj_conv.inner = untag_ptr(this_obj);
35315         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35317         OpenChannelV2_free(this_obj_conv);
35318 }
35319
35320 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_chain_hash"))) TS_OpenChannelV2_get_chain_hash(uint64_t this_ptr) {
35321         LDKOpenChannelV2 this_ptr_conv;
35322         this_ptr_conv.inner = untag_ptr(this_ptr);
35323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35325         this_ptr_conv.is_owned = false;
35326         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35327         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
35328         return ret_arr;
35329 }
35330
35331 void  __attribute__((export_name("TS_OpenChannelV2_set_chain_hash"))) TS_OpenChannelV2_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35332         LDKOpenChannelV2 this_ptr_conv;
35333         this_ptr_conv.inner = untag_ptr(this_ptr);
35334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35336         this_ptr_conv.is_owned = false;
35337         LDKThirtyTwoBytes val_ref;
35338         CHECK(val->arr_len == 32);
35339         memcpy(val_ref.data, val->elems, 32); FREE(val);
35340         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
35341 }
35342
35343 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_temporary_channel_id"))) TS_OpenChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
35344         LDKOpenChannelV2 this_ptr_conv;
35345         this_ptr_conv.inner = untag_ptr(this_ptr);
35346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35348         this_ptr_conv.is_owned = false;
35349         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35350         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
35351         return ret_arr;
35352 }
35353
35354 void  __attribute__((export_name("TS_OpenChannelV2_set_temporary_channel_id"))) TS_OpenChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
35355         LDKOpenChannelV2 this_ptr_conv;
35356         this_ptr_conv.inner = untag_ptr(this_ptr);
35357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35359         this_ptr_conv.is_owned = false;
35360         LDKThirtyTwoBytes val_ref;
35361         CHECK(val->arr_len == 32);
35362         memcpy(val_ref.data, val->elems, 32); FREE(val);
35363         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
35364 }
35365
35366 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) {
35367         LDKOpenChannelV2 this_ptr_conv;
35368         this_ptr_conv.inner = untag_ptr(this_ptr);
35369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35371         this_ptr_conv.is_owned = false;
35372         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
35373         return ret_conv;
35374 }
35375
35376 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) {
35377         LDKOpenChannelV2 this_ptr_conv;
35378         this_ptr_conv.inner = untag_ptr(this_ptr);
35379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35381         this_ptr_conv.is_owned = false;
35382         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
35383 }
35384
35385 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) {
35386         LDKOpenChannelV2 this_ptr_conv;
35387         this_ptr_conv.inner = untag_ptr(this_ptr);
35388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35390         this_ptr_conv.is_owned = false;
35391         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
35392         return ret_conv;
35393 }
35394
35395 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) {
35396         LDKOpenChannelV2 this_ptr_conv;
35397         this_ptr_conv.inner = untag_ptr(this_ptr);
35398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35400         this_ptr_conv.is_owned = false;
35401         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
35402 }
35403
35404 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_satoshis"))) TS_OpenChannelV2_get_funding_satoshis(uint64_t this_ptr) {
35405         LDKOpenChannelV2 this_ptr_conv;
35406         this_ptr_conv.inner = untag_ptr(this_ptr);
35407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35409         this_ptr_conv.is_owned = false;
35410         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
35411         return ret_conv;
35412 }
35413
35414 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_satoshis"))) TS_OpenChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
35415         LDKOpenChannelV2 this_ptr_conv;
35416         this_ptr_conv.inner = untag_ptr(this_ptr);
35417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35419         this_ptr_conv.is_owned = false;
35420         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
35421 }
35422
35423 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_dust_limit_satoshis"))) TS_OpenChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
35424         LDKOpenChannelV2 this_ptr_conv;
35425         this_ptr_conv.inner = untag_ptr(this_ptr);
35426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35428         this_ptr_conv.is_owned = false;
35429         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
35430         return ret_conv;
35431 }
35432
35433 void  __attribute__((export_name("TS_OpenChannelV2_set_dust_limit_satoshis"))) TS_OpenChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
35434         LDKOpenChannelV2 this_ptr_conv;
35435         this_ptr_conv.inner = untag_ptr(this_ptr);
35436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35438         this_ptr_conv.is_owned = false;
35439         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
35440 }
35441
35442 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) {
35443         LDKOpenChannelV2 this_ptr_conv;
35444         this_ptr_conv.inner = untag_ptr(this_ptr);
35445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35447         this_ptr_conv.is_owned = false;
35448         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
35449         return ret_conv;
35450 }
35451
35452 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) {
35453         LDKOpenChannelV2 this_ptr_conv;
35454         this_ptr_conv.inner = untag_ptr(this_ptr);
35455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35457         this_ptr_conv.is_owned = false;
35458         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
35459 }
35460
35461 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_htlc_minimum_msat"))) TS_OpenChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
35462         LDKOpenChannelV2 this_ptr_conv;
35463         this_ptr_conv.inner = untag_ptr(this_ptr);
35464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35466         this_ptr_conv.is_owned = false;
35467         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
35468         return ret_conv;
35469 }
35470
35471 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_minimum_msat"))) TS_OpenChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
35472         LDKOpenChannelV2 this_ptr_conv;
35473         this_ptr_conv.inner = untag_ptr(this_ptr);
35474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35476         this_ptr_conv.is_owned = false;
35477         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
35478 }
35479
35480 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_to_self_delay"))) TS_OpenChannelV2_get_to_self_delay(uint64_t this_ptr) {
35481         LDKOpenChannelV2 this_ptr_conv;
35482         this_ptr_conv.inner = untag_ptr(this_ptr);
35483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35485         this_ptr_conv.is_owned = false;
35486         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
35487         return ret_conv;
35488 }
35489
35490 void  __attribute__((export_name("TS_OpenChannelV2_set_to_self_delay"))) TS_OpenChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
35491         LDKOpenChannelV2 this_ptr_conv;
35492         this_ptr_conv.inner = untag_ptr(this_ptr);
35493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35495         this_ptr_conv.is_owned = false;
35496         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
35497 }
35498
35499 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_max_accepted_htlcs"))) TS_OpenChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
35500         LDKOpenChannelV2 this_ptr_conv;
35501         this_ptr_conv.inner = untag_ptr(this_ptr);
35502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35504         this_ptr_conv.is_owned = false;
35505         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
35506         return ret_conv;
35507 }
35508
35509 void  __attribute__((export_name("TS_OpenChannelV2_set_max_accepted_htlcs"))) TS_OpenChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
35510         LDKOpenChannelV2 this_ptr_conv;
35511         this_ptr_conv.inner = untag_ptr(this_ptr);
35512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35514         this_ptr_conv.is_owned = false;
35515         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
35516 }
35517
35518 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
35519         LDKOpenChannelV2 this_ptr_conv;
35520         this_ptr_conv.inner = untag_ptr(this_ptr);
35521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35523         this_ptr_conv.is_owned = false;
35524         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
35525         return ret_conv;
35526 }
35527
35528 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
35529         LDKOpenChannelV2 this_ptr_conv;
35530         this_ptr_conv.inner = untag_ptr(this_ptr);
35531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35533         this_ptr_conv.is_owned = false;
35534         OpenChannelV2_set_locktime(&this_ptr_conv, val);
35535 }
35536
35537 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_funding_pubkey"))) TS_OpenChannelV2_get_funding_pubkey(uint64_t this_ptr) {
35538         LDKOpenChannelV2 this_ptr_conv;
35539         this_ptr_conv.inner = untag_ptr(this_ptr);
35540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35542         this_ptr_conv.is_owned = false;
35543         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35544         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
35545         return ret_arr;
35546 }
35547
35548 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_pubkey"))) TS_OpenChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
35549         LDKOpenChannelV2 this_ptr_conv;
35550         this_ptr_conv.inner = untag_ptr(this_ptr);
35551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35553         this_ptr_conv.is_owned = false;
35554         LDKPublicKey val_ref;
35555         CHECK(val->arr_len == 33);
35556         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35557         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
35558 }
35559
35560 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_revocation_basepoint"))) TS_OpenChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
35561         LDKOpenChannelV2 this_ptr_conv;
35562         this_ptr_conv.inner = untag_ptr(this_ptr);
35563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35565         this_ptr_conv.is_owned = false;
35566         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35567         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
35568         return ret_arr;
35569 }
35570
35571 void  __attribute__((export_name("TS_OpenChannelV2_set_revocation_basepoint"))) TS_OpenChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
35572         LDKOpenChannelV2 this_ptr_conv;
35573         this_ptr_conv.inner = untag_ptr(this_ptr);
35574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35576         this_ptr_conv.is_owned = false;
35577         LDKPublicKey val_ref;
35578         CHECK(val->arr_len == 33);
35579         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35580         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
35581 }
35582
35583 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_payment_basepoint"))) TS_OpenChannelV2_get_payment_basepoint(uint64_t this_ptr) {
35584         LDKOpenChannelV2 this_ptr_conv;
35585         this_ptr_conv.inner = untag_ptr(this_ptr);
35586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35588         this_ptr_conv.is_owned = false;
35589         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35590         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35591         return ret_arr;
35592 }
35593
35594 void  __attribute__((export_name("TS_OpenChannelV2_set_payment_basepoint"))) TS_OpenChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
35595         LDKOpenChannelV2 this_ptr_conv;
35596         this_ptr_conv.inner = untag_ptr(this_ptr);
35597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35599         this_ptr_conv.is_owned = false;
35600         LDKPublicKey val_ref;
35601         CHECK(val->arr_len == 33);
35602         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35603         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
35604 }
35605
35606 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_delayed_payment_basepoint"))) TS_OpenChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
35607         LDKOpenChannelV2 this_ptr_conv;
35608         this_ptr_conv.inner = untag_ptr(this_ptr);
35609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35611         this_ptr_conv.is_owned = false;
35612         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35613         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35614         return ret_arr;
35615 }
35616
35617 void  __attribute__((export_name("TS_OpenChannelV2_set_delayed_payment_basepoint"))) TS_OpenChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
35618         LDKOpenChannelV2 this_ptr_conv;
35619         this_ptr_conv.inner = untag_ptr(this_ptr);
35620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35622         this_ptr_conv.is_owned = false;
35623         LDKPublicKey val_ref;
35624         CHECK(val->arr_len == 33);
35625         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35626         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35627 }
35628
35629 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_htlc_basepoint"))) TS_OpenChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
35630         LDKOpenChannelV2 this_ptr_conv;
35631         this_ptr_conv.inner = untag_ptr(this_ptr);
35632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35634         this_ptr_conv.is_owned = false;
35635         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35636         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
35637         return ret_arr;
35638 }
35639
35640 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_basepoint"))) TS_OpenChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
35641         LDKOpenChannelV2 this_ptr_conv;
35642         this_ptr_conv.inner = untag_ptr(this_ptr);
35643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35645         this_ptr_conv.is_owned = false;
35646         LDKPublicKey val_ref;
35647         CHECK(val->arr_len == 33);
35648         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35649         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
35650 }
35651
35652 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_first_per_commitment_point"))) TS_OpenChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
35653         LDKOpenChannelV2 this_ptr_conv;
35654         this_ptr_conv.inner = untag_ptr(this_ptr);
35655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35657         this_ptr_conv.is_owned = false;
35658         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35659         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35660         return ret_arr;
35661 }
35662
35663 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) {
35664         LDKOpenChannelV2 this_ptr_conv;
35665         this_ptr_conv.inner = untag_ptr(this_ptr);
35666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35668         this_ptr_conv.is_owned = false;
35669         LDKPublicKey val_ref;
35670         CHECK(val->arr_len == 33);
35671         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35672         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
35673 }
35674
35675 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
35676         LDKOpenChannelV2 this_ptr_conv;
35677         this_ptr_conv.inner = untag_ptr(this_ptr);
35678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35680         this_ptr_conv.is_owned = false;
35681         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35682         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35683         return ret_arr;
35684 }
35685
35686 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) {
35687         LDKOpenChannelV2 this_ptr_conv;
35688         this_ptr_conv.inner = untag_ptr(this_ptr);
35689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35691         this_ptr_conv.is_owned = false;
35692         LDKPublicKey val_ref;
35693         CHECK(val->arr_len == 33);
35694         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35695         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
35696 }
35697
35698 int8_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_flags"))) TS_OpenChannelV2_get_channel_flags(uint64_t this_ptr) {
35699         LDKOpenChannelV2 this_ptr_conv;
35700         this_ptr_conv.inner = untag_ptr(this_ptr);
35701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35703         this_ptr_conv.is_owned = false;
35704         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
35705         return ret_conv;
35706 }
35707
35708 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_flags"))) TS_OpenChannelV2_set_channel_flags(uint64_t this_ptr, int8_t val) {
35709         LDKOpenChannelV2 this_ptr_conv;
35710         this_ptr_conv.inner = untag_ptr(this_ptr);
35711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35713         this_ptr_conv.is_owned = false;
35714         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
35715 }
35716
35717 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_shutdown_scriptpubkey"))) TS_OpenChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
35718         LDKOpenChannelV2 this_ptr_conv;
35719         this_ptr_conv.inner = untag_ptr(this_ptr);
35720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35722         this_ptr_conv.is_owned = false;
35723         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
35724         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
35725         uint64_t ret_ref = tag_ptr(ret_copy, true);
35726         return ret_ref;
35727 }
35728
35729 void  __attribute__((export_name("TS_OpenChannelV2_set_shutdown_scriptpubkey"))) TS_OpenChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
35730         LDKOpenChannelV2 this_ptr_conv;
35731         this_ptr_conv.inner = untag_ptr(this_ptr);
35732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35734         this_ptr_conv.is_owned = false;
35735         void* val_ptr = untag_ptr(val);
35736         CHECK_ACCESS(val_ptr);
35737         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
35738         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
35739         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
35740 }
35741
35742 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_type"))) TS_OpenChannelV2_get_channel_type(uint64_t this_ptr) {
35743         LDKOpenChannelV2 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         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
35749         uint64_t ret_ref = 0;
35750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35752         return ret_ref;
35753 }
35754
35755 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_type"))) TS_OpenChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
35756         LDKOpenChannelV2 this_ptr_conv;
35757         this_ptr_conv.inner = untag_ptr(this_ptr);
35758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35760         this_ptr_conv.is_owned = false;
35761         LDKChannelTypeFeatures val_conv;
35762         val_conv.inner = untag_ptr(val);
35763         val_conv.is_owned = ptr_is_owned(val);
35764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35765         val_conv = ChannelTypeFeatures_clone(&val_conv);
35766         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
35767 }
35768
35769 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
35770         LDKOpenChannelV2 this_ptr_conv;
35771         this_ptr_conv.inner = untag_ptr(this_ptr);
35772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35774         this_ptr_conv.is_owned = false;
35775         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
35776         return ret_conv;
35777 }
35778
35779 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
35780         LDKOpenChannelV2 this_ptr_conv;
35781         this_ptr_conv.inner = untag_ptr(this_ptr);
35782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35784         this_ptr_conv.is_owned = false;
35785         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
35786         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
35787 }
35788
35789 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) {
35790         LDKThirtyTwoBytes chain_hash_arg_ref;
35791         CHECK(chain_hash_arg->arr_len == 32);
35792         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35793         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
35794         CHECK(temporary_channel_id_arg->arr_len == 32);
35795         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
35796         LDKPublicKey funding_pubkey_arg_ref;
35797         CHECK(funding_pubkey_arg->arr_len == 33);
35798         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
35799         LDKPublicKey revocation_basepoint_arg_ref;
35800         CHECK(revocation_basepoint_arg->arr_len == 33);
35801         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
35802         LDKPublicKey payment_basepoint_arg_ref;
35803         CHECK(payment_basepoint_arg->arr_len == 33);
35804         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
35805         LDKPublicKey delayed_payment_basepoint_arg_ref;
35806         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
35807         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
35808         LDKPublicKey htlc_basepoint_arg_ref;
35809         CHECK(htlc_basepoint_arg->arr_len == 33);
35810         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
35811         LDKPublicKey first_per_commitment_point_arg_ref;
35812         CHECK(first_per_commitment_point_arg->arr_len == 33);
35813         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
35814         LDKPublicKey second_per_commitment_point_arg_ref;
35815         CHECK(second_per_commitment_point_arg->arr_len == 33);
35816         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
35817         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
35818         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
35819         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
35820         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
35821         LDKChannelTypeFeatures channel_type_arg_conv;
35822         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
35823         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
35824         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
35825         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
35826         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
35827         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);
35828         uint64_t ret_ref = 0;
35829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35831         return ret_ref;
35832 }
35833
35834 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
35835         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
35836         uint64_t ret_ref = 0;
35837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35839         return ret_ref;
35840 }
35841 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
35842         LDKOpenChannelV2 arg_conv;
35843         arg_conv.inner = untag_ptr(arg);
35844         arg_conv.is_owned = ptr_is_owned(arg);
35845         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35846         arg_conv.is_owned = false;
35847         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
35848         return ret_conv;
35849 }
35850
35851 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
35852         LDKOpenChannelV2 orig_conv;
35853         orig_conv.inner = untag_ptr(orig);
35854         orig_conv.is_owned = ptr_is_owned(orig);
35855         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35856         orig_conv.is_owned = false;
35857         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
35858         uint64_t ret_ref = 0;
35859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35861         return ret_ref;
35862 }
35863
35864 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
35865         LDKOpenChannelV2 a_conv;
35866         a_conv.inner = untag_ptr(a);
35867         a_conv.is_owned = ptr_is_owned(a);
35868         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35869         a_conv.is_owned = false;
35870         LDKOpenChannelV2 b_conv;
35871         b_conv.inner = untag_ptr(b);
35872         b_conv.is_owned = ptr_is_owned(b);
35873         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35874         b_conv.is_owned = false;
35875         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
35876         return ret_conv;
35877 }
35878
35879 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
35880         LDKAcceptChannel this_obj_conv;
35881         this_obj_conv.inner = untag_ptr(this_obj);
35882         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35884         AcceptChannel_free(this_obj_conv);
35885 }
35886
35887 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
35888         LDKAcceptChannel this_ptr_conv;
35889         this_ptr_conv.inner = untag_ptr(this_ptr);
35890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35892         this_ptr_conv.is_owned = false;
35893         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35894         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
35895         return ret_arr;
35896 }
35897
35898 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
35899         LDKAcceptChannel this_ptr_conv;
35900         this_ptr_conv.inner = untag_ptr(this_ptr);
35901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35903         this_ptr_conv.is_owned = false;
35904         LDKThirtyTwoBytes val_ref;
35905         CHECK(val->arr_len == 32);
35906         memcpy(val_ref.data, val->elems, 32); FREE(val);
35907         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
35908 }
35909
35910 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
35911         LDKAcceptChannel this_ptr_conv;
35912         this_ptr_conv.inner = untag_ptr(this_ptr);
35913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35915         this_ptr_conv.is_owned = false;
35916         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
35917         return ret_conv;
35918 }
35919
35920 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
35921         LDKAcceptChannel this_ptr_conv;
35922         this_ptr_conv.inner = untag_ptr(this_ptr);
35923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35925         this_ptr_conv.is_owned = false;
35926         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
35927 }
35928
35929 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) {
35930         LDKAcceptChannel this_ptr_conv;
35931         this_ptr_conv.inner = untag_ptr(this_ptr);
35932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35934         this_ptr_conv.is_owned = false;
35935         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
35936         return ret_conv;
35937 }
35938
35939 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) {
35940         LDKAcceptChannel this_ptr_conv;
35941         this_ptr_conv.inner = untag_ptr(this_ptr);
35942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35944         this_ptr_conv.is_owned = false;
35945         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
35946 }
35947
35948 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
35949         LDKAcceptChannel this_ptr_conv;
35950         this_ptr_conv.inner = untag_ptr(this_ptr);
35951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35953         this_ptr_conv.is_owned = false;
35954         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
35955         return ret_conv;
35956 }
35957
35958 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
35959         LDKAcceptChannel this_ptr_conv;
35960         this_ptr_conv.inner = untag_ptr(this_ptr);
35961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35963         this_ptr_conv.is_owned = false;
35964         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
35965 }
35966
35967 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
35968         LDKAcceptChannel this_ptr_conv;
35969         this_ptr_conv.inner = untag_ptr(this_ptr);
35970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35972         this_ptr_conv.is_owned = false;
35973         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
35974         return ret_conv;
35975 }
35976
35977 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
35978         LDKAcceptChannel this_ptr_conv;
35979         this_ptr_conv.inner = untag_ptr(this_ptr);
35980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35982         this_ptr_conv.is_owned = false;
35983         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
35984 }
35985
35986 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
35987         LDKAcceptChannel this_ptr_conv;
35988         this_ptr_conv.inner = untag_ptr(this_ptr);
35989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35991         this_ptr_conv.is_owned = false;
35992         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
35993         return ret_conv;
35994 }
35995
35996 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
35997         LDKAcceptChannel this_ptr_conv;
35998         this_ptr_conv.inner = untag_ptr(this_ptr);
35999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36001         this_ptr_conv.is_owned = false;
36002         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
36003 }
36004
36005 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
36006         LDKAcceptChannel this_ptr_conv;
36007         this_ptr_conv.inner = untag_ptr(this_ptr);
36008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36010         this_ptr_conv.is_owned = false;
36011         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
36012         return ret_conv;
36013 }
36014
36015 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
36016         LDKAcceptChannel this_ptr_conv;
36017         this_ptr_conv.inner = untag_ptr(this_ptr);
36018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36020         this_ptr_conv.is_owned = false;
36021         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
36022 }
36023
36024 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
36025         LDKAcceptChannel this_ptr_conv;
36026         this_ptr_conv.inner = untag_ptr(this_ptr);
36027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36029         this_ptr_conv.is_owned = false;
36030         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
36031         return ret_conv;
36032 }
36033
36034 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
36035         LDKAcceptChannel this_ptr_conv;
36036         this_ptr_conv.inner = untag_ptr(this_ptr);
36037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36039         this_ptr_conv.is_owned = false;
36040         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
36041 }
36042
36043 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
36044         LDKAcceptChannel this_ptr_conv;
36045         this_ptr_conv.inner = untag_ptr(this_ptr);
36046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36048         this_ptr_conv.is_owned = false;
36049         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36050         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
36051         return ret_arr;
36052 }
36053
36054 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
36055         LDKAcceptChannel this_ptr_conv;
36056         this_ptr_conv.inner = untag_ptr(this_ptr);
36057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36059         this_ptr_conv.is_owned = false;
36060         LDKPublicKey val_ref;
36061         CHECK(val->arr_len == 33);
36062         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36063         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
36064 }
36065
36066 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
36067         LDKAcceptChannel this_ptr_conv;
36068         this_ptr_conv.inner = untag_ptr(this_ptr);
36069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36071         this_ptr_conv.is_owned = false;
36072         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36073         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
36074         return ret_arr;
36075 }
36076
36077 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
36078         LDKAcceptChannel this_ptr_conv;
36079         this_ptr_conv.inner = untag_ptr(this_ptr);
36080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36082         this_ptr_conv.is_owned = false;
36083         LDKPublicKey val_ref;
36084         CHECK(val->arr_len == 33);
36085         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36086         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
36087 }
36088
36089 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
36090         LDKAcceptChannel this_ptr_conv;
36091         this_ptr_conv.inner = untag_ptr(this_ptr);
36092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36094         this_ptr_conv.is_owned = false;
36095         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36096         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
36097         return ret_arr;
36098 }
36099
36100 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
36101         LDKAcceptChannel this_ptr_conv;
36102         this_ptr_conv.inner = untag_ptr(this_ptr);
36103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36105         this_ptr_conv.is_owned = false;
36106         LDKPublicKey val_ref;
36107         CHECK(val->arr_len == 33);
36108         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36109         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
36110 }
36111
36112 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
36113         LDKAcceptChannel this_ptr_conv;
36114         this_ptr_conv.inner = untag_ptr(this_ptr);
36115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36117         this_ptr_conv.is_owned = false;
36118         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36119         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
36120         return ret_arr;
36121 }
36122
36123 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
36124         LDKAcceptChannel this_ptr_conv;
36125         this_ptr_conv.inner = untag_ptr(this_ptr);
36126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36128         this_ptr_conv.is_owned = false;
36129         LDKPublicKey val_ref;
36130         CHECK(val->arr_len == 33);
36131         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36132         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
36133 }
36134
36135 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
36136         LDKAcceptChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36142         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
36143         return ret_arr;
36144 }
36145
36146 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
36147         LDKAcceptChannel this_ptr_conv;
36148         this_ptr_conv.inner = untag_ptr(this_ptr);
36149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36151         this_ptr_conv.is_owned = false;
36152         LDKPublicKey val_ref;
36153         CHECK(val->arr_len == 33);
36154         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36155         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
36156 }
36157
36158 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
36159         LDKAcceptChannel this_ptr_conv;
36160         this_ptr_conv.inner = untag_ptr(this_ptr);
36161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36163         this_ptr_conv.is_owned = false;
36164         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36165         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
36166         return ret_arr;
36167 }
36168
36169 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) {
36170         LDKAcceptChannel this_ptr_conv;
36171         this_ptr_conv.inner = untag_ptr(this_ptr);
36172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36174         this_ptr_conv.is_owned = false;
36175         LDKPublicKey val_ref;
36176         CHECK(val->arr_len == 33);
36177         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36178         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
36179 }
36180
36181 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_shutdown_scriptpubkey"))) TS_AcceptChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
36182         LDKAcceptChannel this_ptr_conv;
36183         this_ptr_conv.inner = untag_ptr(this_ptr);
36184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36186         this_ptr_conv.is_owned = false;
36187         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
36188         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
36189         uint64_t ret_ref = tag_ptr(ret_copy, true);
36190         return ret_ref;
36191 }
36192
36193 void  __attribute__((export_name("TS_AcceptChannel_set_shutdown_scriptpubkey"))) TS_AcceptChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
36194         LDKAcceptChannel this_ptr_conv;
36195         this_ptr_conv.inner = untag_ptr(this_ptr);
36196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36198         this_ptr_conv.is_owned = false;
36199         void* val_ptr = untag_ptr(val);
36200         CHECK_ACCESS(val_ptr);
36201         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
36202         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
36203         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
36204 }
36205
36206 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
36207         LDKAcceptChannel this_ptr_conv;
36208         this_ptr_conv.inner = untag_ptr(this_ptr);
36209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36211         this_ptr_conv.is_owned = false;
36212         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
36213         uint64_t ret_ref = 0;
36214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36216         return ret_ref;
36217 }
36218
36219 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
36220         LDKAcceptChannel this_ptr_conv;
36221         this_ptr_conv.inner = untag_ptr(this_ptr);
36222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36224         this_ptr_conv.is_owned = false;
36225         LDKChannelTypeFeatures val_conv;
36226         val_conv.inner = untag_ptr(val);
36227         val_conv.is_owned = ptr_is_owned(val);
36228         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36229         val_conv = ChannelTypeFeatures_clone(&val_conv);
36230         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
36231 }
36232
36233 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) {
36234         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
36235         CHECK(temporary_channel_id_arg->arr_len == 32);
36236         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
36237         LDKPublicKey funding_pubkey_arg_ref;
36238         CHECK(funding_pubkey_arg->arr_len == 33);
36239         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
36240         LDKPublicKey revocation_basepoint_arg_ref;
36241         CHECK(revocation_basepoint_arg->arr_len == 33);
36242         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
36243         LDKPublicKey payment_point_arg_ref;
36244         CHECK(payment_point_arg->arr_len == 33);
36245         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
36246         LDKPublicKey delayed_payment_basepoint_arg_ref;
36247         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
36248         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
36249         LDKPublicKey htlc_basepoint_arg_ref;
36250         CHECK(htlc_basepoint_arg->arr_len == 33);
36251         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
36252         LDKPublicKey first_per_commitment_point_arg_ref;
36253         CHECK(first_per_commitment_point_arg->arr_len == 33);
36254         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
36255         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
36256         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
36257         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
36258         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
36259         LDKChannelTypeFeatures channel_type_arg_conv;
36260         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
36261         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
36262         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
36263         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
36264         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);
36265         uint64_t ret_ref = 0;
36266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36268         return ret_ref;
36269 }
36270
36271 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
36272         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
36273         uint64_t ret_ref = 0;
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36276         return ret_ref;
36277 }
36278 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
36279         LDKAcceptChannel arg_conv;
36280         arg_conv.inner = untag_ptr(arg);
36281         arg_conv.is_owned = ptr_is_owned(arg);
36282         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36283         arg_conv.is_owned = false;
36284         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
36285         return ret_conv;
36286 }
36287
36288 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
36289         LDKAcceptChannel orig_conv;
36290         orig_conv.inner = untag_ptr(orig);
36291         orig_conv.is_owned = ptr_is_owned(orig);
36292         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36293         orig_conv.is_owned = false;
36294         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
36295         uint64_t ret_ref = 0;
36296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36298         return ret_ref;
36299 }
36300
36301 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
36302         LDKAcceptChannel a_conv;
36303         a_conv.inner = untag_ptr(a);
36304         a_conv.is_owned = ptr_is_owned(a);
36305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36306         a_conv.is_owned = false;
36307         LDKAcceptChannel b_conv;
36308         b_conv.inner = untag_ptr(b);
36309         b_conv.is_owned = ptr_is_owned(b);
36310         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36311         b_conv.is_owned = false;
36312         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
36313         return ret_conv;
36314 }
36315
36316 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
36317         LDKAcceptChannelV2 this_obj_conv;
36318         this_obj_conv.inner = untag_ptr(this_obj);
36319         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36321         AcceptChannelV2_free(this_obj_conv);
36322 }
36323
36324 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_temporary_channel_id"))) TS_AcceptChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
36325         LDKAcceptChannelV2 this_ptr_conv;
36326         this_ptr_conv.inner = untag_ptr(this_ptr);
36327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36329         this_ptr_conv.is_owned = false;
36330         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36331         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
36332         return ret_arr;
36333 }
36334
36335 void  __attribute__((export_name("TS_AcceptChannelV2_set_temporary_channel_id"))) TS_AcceptChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
36336         LDKAcceptChannelV2 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         LDKThirtyTwoBytes val_ref;
36342         CHECK(val->arr_len == 32);
36343         memcpy(val_ref.data, val->elems, 32); FREE(val);
36344         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
36345 }
36346
36347 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
36348         LDKAcceptChannelV2 this_ptr_conv;
36349         this_ptr_conv.inner = untag_ptr(this_ptr);
36350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36352         this_ptr_conv.is_owned = false;
36353         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
36354         return ret_conv;
36355 }
36356
36357 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
36358         LDKAcceptChannelV2 this_ptr_conv;
36359         this_ptr_conv.inner = untag_ptr(this_ptr);
36360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36362         this_ptr_conv.is_owned = false;
36363         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
36364 }
36365
36366 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_dust_limit_satoshis"))) TS_AcceptChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
36367         LDKAcceptChannelV2 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         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
36373         return ret_conv;
36374 }
36375
36376 void  __attribute__((export_name("TS_AcceptChannelV2_set_dust_limit_satoshis"))) TS_AcceptChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
36377         LDKAcceptChannelV2 this_ptr_conv;
36378         this_ptr_conv.inner = untag_ptr(this_ptr);
36379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36381         this_ptr_conv.is_owned = false;
36382         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
36383 }
36384
36385 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) {
36386         LDKAcceptChannelV2 this_ptr_conv;
36387         this_ptr_conv.inner = untag_ptr(this_ptr);
36388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36390         this_ptr_conv.is_owned = false;
36391         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
36392         return ret_conv;
36393 }
36394
36395 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) {
36396         LDKAcceptChannelV2 this_ptr_conv;
36397         this_ptr_conv.inner = untag_ptr(this_ptr);
36398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36400         this_ptr_conv.is_owned = false;
36401         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
36402 }
36403
36404 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_minimum_msat"))) TS_AcceptChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
36405         LDKAcceptChannelV2 this_ptr_conv;
36406         this_ptr_conv.inner = untag_ptr(this_ptr);
36407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36409         this_ptr_conv.is_owned = false;
36410         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
36411         return ret_conv;
36412 }
36413
36414 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_minimum_msat"))) TS_AcceptChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
36415         LDKAcceptChannelV2 this_ptr_conv;
36416         this_ptr_conv.inner = untag_ptr(this_ptr);
36417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36419         this_ptr_conv.is_owned = false;
36420         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
36421 }
36422
36423 int32_t  __attribute__((export_name("TS_AcceptChannelV2_get_minimum_depth"))) TS_AcceptChannelV2_get_minimum_depth(uint64_t this_ptr) {
36424         LDKAcceptChannelV2 this_ptr_conv;
36425         this_ptr_conv.inner = untag_ptr(this_ptr);
36426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36428         this_ptr_conv.is_owned = false;
36429         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
36430         return ret_conv;
36431 }
36432
36433 void  __attribute__((export_name("TS_AcceptChannelV2_set_minimum_depth"))) TS_AcceptChannelV2_set_minimum_depth(uint64_t this_ptr, int32_t val) {
36434         LDKAcceptChannelV2 this_ptr_conv;
36435         this_ptr_conv.inner = untag_ptr(this_ptr);
36436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36438         this_ptr_conv.is_owned = false;
36439         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
36440 }
36441
36442 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_to_self_delay"))) TS_AcceptChannelV2_get_to_self_delay(uint64_t this_ptr) {
36443         LDKAcceptChannelV2 this_ptr_conv;
36444         this_ptr_conv.inner = untag_ptr(this_ptr);
36445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36447         this_ptr_conv.is_owned = false;
36448         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
36449         return ret_conv;
36450 }
36451
36452 void  __attribute__((export_name("TS_AcceptChannelV2_set_to_self_delay"))) TS_AcceptChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
36453         LDKAcceptChannelV2 this_ptr_conv;
36454         this_ptr_conv.inner = untag_ptr(this_ptr);
36455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36457         this_ptr_conv.is_owned = false;
36458         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
36459 }
36460
36461 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_accepted_htlcs"))) TS_AcceptChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
36462         LDKAcceptChannelV2 this_ptr_conv;
36463         this_ptr_conv.inner = untag_ptr(this_ptr);
36464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36466         this_ptr_conv.is_owned = false;
36467         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
36468         return ret_conv;
36469 }
36470
36471 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_accepted_htlcs"))) TS_AcceptChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
36472         LDKAcceptChannelV2 this_ptr_conv;
36473         this_ptr_conv.inner = untag_ptr(this_ptr);
36474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36476         this_ptr_conv.is_owned = false;
36477         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
36478 }
36479
36480 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_funding_pubkey"))) TS_AcceptChannelV2_get_funding_pubkey(uint64_t this_ptr) {
36481         LDKAcceptChannelV2 this_ptr_conv;
36482         this_ptr_conv.inner = untag_ptr(this_ptr);
36483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36485         this_ptr_conv.is_owned = false;
36486         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36487         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
36488         return ret_arr;
36489 }
36490
36491 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_pubkey"))) TS_AcceptChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
36492         LDKAcceptChannelV2 this_ptr_conv;
36493         this_ptr_conv.inner = untag_ptr(this_ptr);
36494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36496         this_ptr_conv.is_owned = false;
36497         LDKPublicKey val_ref;
36498         CHECK(val->arr_len == 33);
36499         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36500         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
36501 }
36502
36503 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_revocation_basepoint"))) TS_AcceptChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
36504         LDKAcceptChannelV2 this_ptr_conv;
36505         this_ptr_conv.inner = untag_ptr(this_ptr);
36506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36508         this_ptr_conv.is_owned = false;
36509         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36510         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
36511         return ret_arr;
36512 }
36513
36514 void  __attribute__((export_name("TS_AcceptChannelV2_set_revocation_basepoint"))) TS_AcceptChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
36515         LDKAcceptChannelV2 this_ptr_conv;
36516         this_ptr_conv.inner = untag_ptr(this_ptr);
36517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36519         this_ptr_conv.is_owned = false;
36520         LDKPublicKey val_ref;
36521         CHECK(val->arr_len == 33);
36522         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36523         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
36524 }
36525
36526 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_payment_basepoint"))) TS_AcceptChannelV2_get_payment_basepoint(uint64_t this_ptr) {
36527         LDKAcceptChannelV2 this_ptr_conv;
36528         this_ptr_conv.inner = untag_ptr(this_ptr);
36529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36531         this_ptr_conv.is_owned = false;
36532         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36533         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
36534         return ret_arr;
36535 }
36536
36537 void  __attribute__((export_name("TS_AcceptChannelV2_set_payment_basepoint"))) TS_AcceptChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
36538         LDKAcceptChannelV2 this_ptr_conv;
36539         this_ptr_conv.inner = untag_ptr(this_ptr);
36540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36542         this_ptr_conv.is_owned = false;
36543         LDKPublicKey val_ref;
36544         CHECK(val->arr_len == 33);
36545         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36546         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
36547 }
36548
36549 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_delayed_payment_basepoint"))) TS_AcceptChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
36550         LDKAcceptChannelV2 this_ptr_conv;
36551         this_ptr_conv.inner = untag_ptr(this_ptr);
36552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36554         this_ptr_conv.is_owned = false;
36555         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36556         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
36557         return ret_arr;
36558 }
36559
36560 void  __attribute__((export_name("TS_AcceptChannelV2_set_delayed_payment_basepoint"))) TS_AcceptChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
36561         LDKAcceptChannelV2 this_ptr_conv;
36562         this_ptr_conv.inner = untag_ptr(this_ptr);
36563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36565         this_ptr_conv.is_owned = false;
36566         LDKPublicKey val_ref;
36567         CHECK(val->arr_len == 33);
36568         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36569         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
36570 }
36571
36572 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_basepoint"))) TS_AcceptChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
36573         LDKAcceptChannelV2 this_ptr_conv;
36574         this_ptr_conv.inner = untag_ptr(this_ptr);
36575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36577         this_ptr_conv.is_owned = false;
36578         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36579         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
36580         return ret_arr;
36581 }
36582
36583 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_basepoint"))) TS_AcceptChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
36584         LDKAcceptChannelV2 this_ptr_conv;
36585         this_ptr_conv.inner = untag_ptr(this_ptr);
36586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36588         this_ptr_conv.is_owned = false;
36589         LDKPublicKey val_ref;
36590         CHECK(val->arr_len == 33);
36591         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36592         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
36593 }
36594
36595 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_first_per_commitment_point"))) TS_AcceptChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
36596         LDKAcceptChannelV2 this_ptr_conv;
36597         this_ptr_conv.inner = untag_ptr(this_ptr);
36598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36600         this_ptr_conv.is_owned = false;
36601         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36602         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
36603         return ret_arr;
36604 }
36605
36606 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) {
36607         LDKAcceptChannelV2 this_ptr_conv;
36608         this_ptr_conv.inner = untag_ptr(this_ptr);
36609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36611         this_ptr_conv.is_owned = false;
36612         LDKPublicKey val_ref;
36613         CHECK(val->arr_len == 33);
36614         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36615         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
36616 }
36617
36618 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
36619         LDKAcceptChannelV2 this_ptr_conv;
36620         this_ptr_conv.inner = untag_ptr(this_ptr);
36621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36623         this_ptr_conv.is_owned = false;
36624         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36625         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
36626         return ret_arr;
36627 }
36628
36629 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) {
36630         LDKAcceptChannelV2 this_ptr_conv;
36631         this_ptr_conv.inner = untag_ptr(this_ptr);
36632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36634         this_ptr_conv.is_owned = false;
36635         LDKPublicKey val_ref;
36636         CHECK(val->arr_len == 33);
36637         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36638         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
36639 }
36640
36641 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_shutdown_scriptpubkey"))) TS_AcceptChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
36642         LDKAcceptChannelV2 this_ptr_conv;
36643         this_ptr_conv.inner = untag_ptr(this_ptr);
36644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36646         this_ptr_conv.is_owned = false;
36647         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
36648         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
36649         uint64_t ret_ref = tag_ptr(ret_copy, true);
36650         return ret_ref;
36651 }
36652
36653 void  __attribute__((export_name("TS_AcceptChannelV2_set_shutdown_scriptpubkey"))) TS_AcceptChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
36654         LDKAcceptChannelV2 this_ptr_conv;
36655         this_ptr_conv.inner = untag_ptr(this_ptr);
36656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36658         this_ptr_conv.is_owned = false;
36659         void* val_ptr = untag_ptr(val);
36660         CHECK_ACCESS(val_ptr);
36661         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
36662         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
36663         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
36664 }
36665
36666 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_channel_type"))) TS_AcceptChannelV2_get_channel_type(uint64_t this_ptr) {
36667         LDKAcceptChannelV2 this_ptr_conv;
36668         this_ptr_conv.inner = untag_ptr(this_ptr);
36669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36671         this_ptr_conv.is_owned = false;
36672         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
36673         uint64_t ret_ref = 0;
36674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36676         return ret_ref;
36677 }
36678
36679 void  __attribute__((export_name("TS_AcceptChannelV2_set_channel_type"))) TS_AcceptChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
36680         LDKAcceptChannelV2 this_ptr_conv;
36681         this_ptr_conv.inner = untag_ptr(this_ptr);
36682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36684         this_ptr_conv.is_owned = false;
36685         LDKChannelTypeFeatures val_conv;
36686         val_conv.inner = untag_ptr(val);
36687         val_conv.is_owned = ptr_is_owned(val);
36688         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36689         val_conv = ChannelTypeFeatures_clone(&val_conv);
36690         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
36691 }
36692
36693 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
36694         LDKAcceptChannelV2 this_ptr_conv;
36695         this_ptr_conv.inner = untag_ptr(this_ptr);
36696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36698         this_ptr_conv.is_owned = false;
36699         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
36700         return ret_conv;
36701 }
36702
36703 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
36704         LDKAcceptChannelV2 this_ptr_conv;
36705         this_ptr_conv.inner = untag_ptr(this_ptr);
36706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36708         this_ptr_conv.is_owned = false;
36709         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
36710         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
36711 }
36712
36713 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) {
36714         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
36715         CHECK(temporary_channel_id_arg->arr_len == 32);
36716         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
36717         LDKPublicKey funding_pubkey_arg_ref;
36718         CHECK(funding_pubkey_arg->arr_len == 33);
36719         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
36720         LDKPublicKey revocation_basepoint_arg_ref;
36721         CHECK(revocation_basepoint_arg->arr_len == 33);
36722         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
36723         LDKPublicKey payment_basepoint_arg_ref;
36724         CHECK(payment_basepoint_arg->arr_len == 33);
36725         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
36726         LDKPublicKey delayed_payment_basepoint_arg_ref;
36727         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
36728         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
36729         LDKPublicKey htlc_basepoint_arg_ref;
36730         CHECK(htlc_basepoint_arg->arr_len == 33);
36731         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
36732         LDKPublicKey first_per_commitment_point_arg_ref;
36733         CHECK(first_per_commitment_point_arg->arr_len == 33);
36734         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
36735         LDKPublicKey second_per_commitment_point_arg_ref;
36736         CHECK(second_per_commitment_point_arg->arr_len == 33);
36737         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
36738         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
36739         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
36740         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
36741         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
36742         LDKChannelTypeFeatures channel_type_arg_conv;
36743         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
36744         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
36745         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
36746         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
36747         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
36748         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);
36749         uint64_t ret_ref = 0;
36750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36752         return ret_ref;
36753 }
36754
36755 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
36756         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
36757         uint64_t ret_ref = 0;
36758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36760         return ret_ref;
36761 }
36762 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
36763         LDKAcceptChannelV2 arg_conv;
36764         arg_conv.inner = untag_ptr(arg);
36765         arg_conv.is_owned = ptr_is_owned(arg);
36766         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36767         arg_conv.is_owned = false;
36768         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
36769         return ret_conv;
36770 }
36771
36772 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
36773         LDKAcceptChannelV2 orig_conv;
36774         orig_conv.inner = untag_ptr(orig);
36775         orig_conv.is_owned = ptr_is_owned(orig);
36776         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36777         orig_conv.is_owned = false;
36778         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
36779         uint64_t ret_ref = 0;
36780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36782         return ret_ref;
36783 }
36784
36785 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
36786         LDKAcceptChannelV2 a_conv;
36787         a_conv.inner = untag_ptr(a);
36788         a_conv.is_owned = ptr_is_owned(a);
36789         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36790         a_conv.is_owned = false;
36791         LDKAcceptChannelV2 b_conv;
36792         b_conv.inner = untag_ptr(b);
36793         b_conv.is_owned = ptr_is_owned(b);
36794         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36795         b_conv.is_owned = false;
36796         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
36797         return ret_conv;
36798 }
36799
36800 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
36801         LDKFundingCreated this_obj_conv;
36802         this_obj_conv.inner = untag_ptr(this_obj);
36803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36805         FundingCreated_free(this_obj_conv);
36806 }
36807
36808 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
36809         LDKFundingCreated this_ptr_conv;
36810         this_ptr_conv.inner = untag_ptr(this_ptr);
36811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36813         this_ptr_conv.is_owned = false;
36814         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36815         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
36816         return ret_arr;
36817 }
36818
36819 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
36820         LDKFundingCreated this_ptr_conv;
36821         this_ptr_conv.inner = untag_ptr(this_ptr);
36822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36824         this_ptr_conv.is_owned = false;
36825         LDKThirtyTwoBytes val_ref;
36826         CHECK(val->arr_len == 32);
36827         memcpy(val_ref.data, val->elems, 32); FREE(val);
36828         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
36829 }
36830
36831 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
36832         LDKFundingCreated this_ptr_conv;
36833         this_ptr_conv.inner = untag_ptr(this_ptr);
36834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36836         this_ptr_conv.is_owned = false;
36837         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36838         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
36839         return ret_arr;
36840 }
36841
36842 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
36843         LDKFundingCreated this_ptr_conv;
36844         this_ptr_conv.inner = untag_ptr(this_ptr);
36845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36847         this_ptr_conv.is_owned = false;
36848         LDKThirtyTwoBytes val_ref;
36849         CHECK(val->arr_len == 32);
36850         memcpy(val_ref.data, val->elems, 32); FREE(val);
36851         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
36852 }
36853
36854 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
36855         LDKFundingCreated this_ptr_conv;
36856         this_ptr_conv.inner = untag_ptr(this_ptr);
36857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36859         this_ptr_conv.is_owned = false;
36860         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
36861         return ret_conv;
36862 }
36863
36864 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
36865         LDKFundingCreated 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         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
36871 }
36872
36873 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
36874         LDKFundingCreated this_ptr_conv;
36875         this_ptr_conv.inner = untag_ptr(this_ptr);
36876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36878         this_ptr_conv.is_owned = false;
36879         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36880         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
36881         return ret_arr;
36882 }
36883
36884 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
36885         LDKFundingCreated this_ptr_conv;
36886         this_ptr_conv.inner = untag_ptr(this_ptr);
36887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36889         this_ptr_conv.is_owned = false;
36890         LDKSignature val_ref;
36891         CHECK(val->arr_len == 64);
36892         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
36893         FundingCreated_set_signature(&this_ptr_conv, val_ref);
36894 }
36895
36896 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) {
36897         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
36898         CHECK(temporary_channel_id_arg->arr_len == 32);
36899         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
36900         LDKThirtyTwoBytes funding_txid_arg_ref;
36901         CHECK(funding_txid_arg->arr_len == 32);
36902         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
36903         LDKSignature signature_arg_ref;
36904         CHECK(signature_arg->arr_len == 64);
36905         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
36906         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
36907         uint64_t ret_ref = 0;
36908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36910         return ret_ref;
36911 }
36912
36913 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
36914         LDKFundingCreated ret_var = FundingCreated_clone(arg);
36915         uint64_t ret_ref = 0;
36916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36918         return ret_ref;
36919 }
36920 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
36921         LDKFundingCreated arg_conv;
36922         arg_conv.inner = untag_ptr(arg);
36923         arg_conv.is_owned = ptr_is_owned(arg);
36924         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36925         arg_conv.is_owned = false;
36926         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
36927         return ret_conv;
36928 }
36929
36930 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
36931         LDKFundingCreated orig_conv;
36932         orig_conv.inner = untag_ptr(orig);
36933         orig_conv.is_owned = ptr_is_owned(orig);
36934         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36935         orig_conv.is_owned = false;
36936         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
36937         uint64_t ret_ref = 0;
36938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36940         return ret_ref;
36941 }
36942
36943 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
36944         LDKFundingCreated a_conv;
36945         a_conv.inner = untag_ptr(a);
36946         a_conv.is_owned = ptr_is_owned(a);
36947         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36948         a_conv.is_owned = false;
36949         LDKFundingCreated b_conv;
36950         b_conv.inner = untag_ptr(b);
36951         b_conv.is_owned = ptr_is_owned(b);
36952         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36953         b_conv.is_owned = false;
36954         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
36955         return ret_conv;
36956 }
36957
36958 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
36959         LDKFundingSigned this_obj_conv;
36960         this_obj_conv.inner = untag_ptr(this_obj);
36961         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36963         FundingSigned_free(this_obj_conv);
36964 }
36965
36966 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
36967         LDKFundingSigned this_ptr_conv;
36968         this_ptr_conv.inner = untag_ptr(this_ptr);
36969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36971         this_ptr_conv.is_owned = false;
36972         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36973         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
36974         return ret_arr;
36975 }
36976
36977 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
36978         LDKFundingSigned this_ptr_conv;
36979         this_ptr_conv.inner = untag_ptr(this_ptr);
36980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36982         this_ptr_conv.is_owned = false;
36983         LDKThirtyTwoBytes val_ref;
36984         CHECK(val->arr_len == 32);
36985         memcpy(val_ref.data, val->elems, 32); FREE(val);
36986         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
36987 }
36988
36989 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
36990         LDKFundingSigned this_ptr_conv;
36991         this_ptr_conv.inner = untag_ptr(this_ptr);
36992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36994         this_ptr_conv.is_owned = false;
36995         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36996         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
36997         return ret_arr;
36998 }
36999
37000 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
37001         LDKFundingSigned this_ptr_conv;
37002         this_ptr_conv.inner = untag_ptr(this_ptr);
37003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37005         this_ptr_conv.is_owned = false;
37006         LDKSignature val_ref;
37007         CHECK(val->arr_len == 64);
37008         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
37009         FundingSigned_set_signature(&this_ptr_conv, val_ref);
37010 }
37011
37012 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
37013         LDKThirtyTwoBytes channel_id_arg_ref;
37014         CHECK(channel_id_arg->arr_len == 32);
37015         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37016         LDKSignature signature_arg_ref;
37017         CHECK(signature_arg->arr_len == 64);
37018         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
37019         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
37020         uint64_t ret_ref = 0;
37021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37023         return ret_ref;
37024 }
37025
37026 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
37027         LDKFundingSigned ret_var = FundingSigned_clone(arg);
37028         uint64_t ret_ref = 0;
37029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37031         return ret_ref;
37032 }
37033 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
37034         LDKFundingSigned arg_conv;
37035         arg_conv.inner = untag_ptr(arg);
37036         arg_conv.is_owned = ptr_is_owned(arg);
37037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37038         arg_conv.is_owned = false;
37039         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
37040         return ret_conv;
37041 }
37042
37043 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
37044         LDKFundingSigned orig_conv;
37045         orig_conv.inner = untag_ptr(orig);
37046         orig_conv.is_owned = ptr_is_owned(orig);
37047         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37048         orig_conv.is_owned = false;
37049         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
37050         uint64_t ret_ref = 0;
37051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37053         return ret_ref;
37054 }
37055
37056 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
37057         LDKFundingSigned a_conv;
37058         a_conv.inner = untag_ptr(a);
37059         a_conv.is_owned = ptr_is_owned(a);
37060         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37061         a_conv.is_owned = false;
37062         LDKFundingSigned b_conv;
37063         b_conv.inner = untag_ptr(b);
37064         b_conv.is_owned = ptr_is_owned(b);
37065         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37066         b_conv.is_owned = false;
37067         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
37068         return ret_conv;
37069 }
37070
37071 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
37072         LDKChannelReady this_obj_conv;
37073         this_obj_conv.inner = untag_ptr(this_obj);
37074         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37076         ChannelReady_free(this_obj_conv);
37077 }
37078
37079 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
37080         LDKChannelReady this_ptr_conv;
37081         this_ptr_conv.inner = untag_ptr(this_ptr);
37082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37084         this_ptr_conv.is_owned = false;
37085         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37086         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
37087         return ret_arr;
37088 }
37089
37090 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37091         LDKChannelReady this_ptr_conv;
37092         this_ptr_conv.inner = untag_ptr(this_ptr);
37093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37095         this_ptr_conv.is_owned = false;
37096         LDKThirtyTwoBytes val_ref;
37097         CHECK(val->arr_len == 32);
37098         memcpy(val_ref.data, val->elems, 32); FREE(val);
37099         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
37100 }
37101
37102 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
37103         LDKChannelReady this_ptr_conv;
37104         this_ptr_conv.inner = untag_ptr(this_ptr);
37105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37107         this_ptr_conv.is_owned = false;
37108         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37109         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37110         return ret_arr;
37111 }
37112
37113 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) {
37114         LDKChannelReady this_ptr_conv;
37115         this_ptr_conv.inner = untag_ptr(this_ptr);
37116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37118         this_ptr_conv.is_owned = false;
37119         LDKPublicKey val_ref;
37120         CHECK(val->arr_len == 33);
37121         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37122         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
37123 }
37124
37125 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
37126         LDKChannelReady this_ptr_conv;
37127         this_ptr_conv.inner = untag_ptr(this_ptr);
37128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37130         this_ptr_conv.is_owned = false;
37131         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37132         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
37133         uint64_t ret_ref = tag_ptr(ret_copy, true);
37134         return ret_ref;
37135 }
37136
37137 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) {
37138         LDKChannelReady this_ptr_conv;
37139         this_ptr_conv.inner = untag_ptr(this_ptr);
37140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37142         this_ptr_conv.is_owned = false;
37143         void* val_ptr = untag_ptr(val);
37144         CHECK_ACCESS(val_ptr);
37145         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37146         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37147         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
37148 }
37149
37150 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) {
37151         LDKThirtyTwoBytes channel_id_arg_ref;
37152         CHECK(channel_id_arg->arr_len == 32);
37153         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37154         LDKPublicKey next_per_commitment_point_arg_ref;
37155         CHECK(next_per_commitment_point_arg->arr_len == 33);
37156         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
37157         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
37158         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
37159         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
37160         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
37161         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
37162         uint64_t ret_ref = 0;
37163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37165         return ret_ref;
37166 }
37167
37168 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
37169         LDKChannelReady ret_var = ChannelReady_clone(arg);
37170         uint64_t ret_ref = 0;
37171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37173         return ret_ref;
37174 }
37175 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
37176         LDKChannelReady arg_conv;
37177         arg_conv.inner = untag_ptr(arg);
37178         arg_conv.is_owned = ptr_is_owned(arg);
37179         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37180         arg_conv.is_owned = false;
37181         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
37182         return ret_conv;
37183 }
37184
37185 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
37186         LDKChannelReady orig_conv;
37187         orig_conv.inner = untag_ptr(orig);
37188         orig_conv.is_owned = ptr_is_owned(orig);
37189         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37190         orig_conv.is_owned = false;
37191         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
37192         uint64_t ret_ref = 0;
37193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37195         return ret_ref;
37196 }
37197
37198 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
37199         LDKChannelReady a_conv;
37200         a_conv.inner = untag_ptr(a);
37201         a_conv.is_owned = ptr_is_owned(a);
37202         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37203         a_conv.is_owned = false;
37204         LDKChannelReady b_conv;
37205         b_conv.inner = untag_ptr(b);
37206         b_conv.is_owned = ptr_is_owned(b);
37207         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37208         b_conv.is_owned = false;
37209         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
37210         return ret_conv;
37211 }
37212
37213 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
37214         LDKTxAddInput this_obj_conv;
37215         this_obj_conv.inner = untag_ptr(this_obj);
37216         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37218         TxAddInput_free(this_obj_conv);
37219 }
37220
37221 int8_tArray  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
37222         LDKTxAddInput this_ptr_conv;
37223         this_ptr_conv.inner = untag_ptr(this_ptr);
37224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37226         this_ptr_conv.is_owned = false;
37227         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37228         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
37229         return ret_arr;
37230 }
37231
37232 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37233         LDKTxAddInput this_ptr_conv;
37234         this_ptr_conv.inner = untag_ptr(this_ptr);
37235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37237         this_ptr_conv.is_owned = false;
37238         LDKThirtyTwoBytes val_ref;
37239         CHECK(val->arr_len == 32);
37240         memcpy(val_ref.data, val->elems, 32); FREE(val);
37241         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
37242 }
37243
37244 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
37245         LDKTxAddInput this_ptr_conv;
37246         this_ptr_conv.inner = untag_ptr(this_ptr);
37247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37249         this_ptr_conv.is_owned = false;
37250         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
37251         return ret_conv;
37252 }
37253
37254 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
37255         LDKTxAddInput this_ptr_conv;
37256         this_ptr_conv.inner = untag_ptr(this_ptr);
37257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37259         this_ptr_conv.is_owned = false;
37260         TxAddInput_set_serial_id(&this_ptr_conv, val);
37261 }
37262
37263 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
37264         LDKTxAddInput this_ptr_conv;
37265         this_ptr_conv.inner = untag_ptr(this_ptr);
37266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37268         this_ptr_conv.is_owned = false;
37269         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
37270         uint64_t ret_ref = 0;
37271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37273         return ret_ref;
37274 }
37275
37276 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
37277         LDKTxAddInput this_ptr_conv;
37278         this_ptr_conv.inner = untag_ptr(this_ptr);
37279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37281         this_ptr_conv.is_owned = false;
37282         LDKTransactionU16LenLimited val_conv;
37283         val_conv.inner = untag_ptr(val);
37284         val_conv.is_owned = ptr_is_owned(val);
37285         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37286         val_conv = TransactionU16LenLimited_clone(&val_conv);
37287         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
37288 }
37289
37290 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
37291         LDKTxAddInput this_ptr_conv;
37292         this_ptr_conv.inner = untag_ptr(this_ptr);
37293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37295         this_ptr_conv.is_owned = false;
37296         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
37297         return ret_conv;
37298 }
37299
37300 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
37301         LDKTxAddInput this_ptr_conv;
37302         this_ptr_conv.inner = untag_ptr(this_ptr);
37303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37305         this_ptr_conv.is_owned = false;
37306         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
37307 }
37308
37309 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
37310         LDKTxAddInput this_ptr_conv;
37311         this_ptr_conv.inner = untag_ptr(this_ptr);
37312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37314         this_ptr_conv.is_owned = false;
37315         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
37316         return ret_conv;
37317 }
37318
37319 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
37320         LDKTxAddInput this_ptr_conv;
37321         this_ptr_conv.inner = untag_ptr(this_ptr);
37322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37324         this_ptr_conv.is_owned = false;
37325         TxAddInput_set_sequence(&this_ptr_conv, val);
37326 }
37327
37328 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) {
37329         LDKThirtyTwoBytes channel_id_arg_ref;
37330         CHECK(channel_id_arg->arr_len == 32);
37331         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37332         LDKTransactionU16LenLimited prevtx_arg_conv;
37333         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
37334         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
37335         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
37336         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
37337         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
37338         uint64_t ret_ref = 0;
37339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37341         return ret_ref;
37342 }
37343
37344 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
37345         LDKTxAddInput ret_var = TxAddInput_clone(arg);
37346         uint64_t ret_ref = 0;
37347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37349         return ret_ref;
37350 }
37351 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
37352         LDKTxAddInput arg_conv;
37353         arg_conv.inner = untag_ptr(arg);
37354         arg_conv.is_owned = ptr_is_owned(arg);
37355         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37356         arg_conv.is_owned = false;
37357         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
37358         return ret_conv;
37359 }
37360
37361 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
37362         LDKTxAddInput orig_conv;
37363         orig_conv.inner = untag_ptr(orig);
37364         orig_conv.is_owned = ptr_is_owned(orig);
37365         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37366         orig_conv.is_owned = false;
37367         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
37368         uint64_t ret_ref = 0;
37369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37371         return ret_ref;
37372 }
37373
37374 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
37375         LDKTxAddInput a_conv;
37376         a_conv.inner = untag_ptr(a);
37377         a_conv.is_owned = ptr_is_owned(a);
37378         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37379         a_conv.is_owned = false;
37380         LDKTxAddInput b_conv;
37381         b_conv.inner = untag_ptr(b);
37382         b_conv.is_owned = ptr_is_owned(b);
37383         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37384         b_conv.is_owned = false;
37385         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
37386         return ret_conv;
37387 }
37388
37389 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
37390         LDKTxAddOutput this_obj_conv;
37391         this_obj_conv.inner = untag_ptr(this_obj);
37392         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37394         TxAddOutput_free(this_obj_conv);
37395 }
37396
37397 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
37398         LDKTxAddOutput 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37404         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
37405         return ret_arr;
37406 }
37407
37408 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37409         LDKTxAddOutput this_ptr_conv;
37410         this_ptr_conv.inner = untag_ptr(this_ptr);
37411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37413         this_ptr_conv.is_owned = false;
37414         LDKThirtyTwoBytes val_ref;
37415         CHECK(val->arr_len == 32);
37416         memcpy(val_ref.data, val->elems, 32); FREE(val);
37417         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
37418 }
37419
37420 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
37421         LDKTxAddOutput this_ptr_conv;
37422         this_ptr_conv.inner = untag_ptr(this_ptr);
37423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37425         this_ptr_conv.is_owned = false;
37426         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
37427         return ret_conv;
37428 }
37429
37430 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
37431         LDKTxAddOutput this_ptr_conv;
37432         this_ptr_conv.inner = untag_ptr(this_ptr);
37433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37435         this_ptr_conv.is_owned = false;
37436         TxAddOutput_set_serial_id(&this_ptr_conv, val);
37437 }
37438
37439 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
37440         LDKTxAddOutput this_ptr_conv;
37441         this_ptr_conv.inner = untag_ptr(this_ptr);
37442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37444         this_ptr_conv.is_owned = false;
37445         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
37446         return ret_conv;
37447 }
37448
37449 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
37450         LDKTxAddOutput this_ptr_conv;
37451         this_ptr_conv.inner = untag_ptr(this_ptr);
37452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37454         this_ptr_conv.is_owned = false;
37455         TxAddOutput_set_sats(&this_ptr_conv, val);
37456 }
37457
37458 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
37459         LDKTxAddOutput this_ptr_conv;
37460         this_ptr_conv.inner = untag_ptr(this_ptr);
37461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37463         this_ptr_conv.is_owned = false;
37464         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
37465         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37466         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37467         return ret_arr;
37468 }
37469
37470 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
37471         LDKTxAddOutput 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         LDKCVec_u8Z val_ref;
37477         val_ref.datalen = val->arr_len;
37478         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37479         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37480         TxAddOutput_set_script(&this_ptr_conv, val_ref);
37481 }
37482
37483 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) {
37484         LDKThirtyTwoBytes channel_id_arg_ref;
37485         CHECK(channel_id_arg->arr_len == 32);
37486         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37487         LDKCVec_u8Z script_arg_ref;
37488         script_arg_ref.datalen = script_arg->arr_len;
37489         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37490         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
37491         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
37492         uint64_t ret_ref = 0;
37493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37495         return ret_ref;
37496 }
37497
37498 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
37499         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
37500         uint64_t ret_ref = 0;
37501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37503         return ret_ref;
37504 }
37505 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
37506         LDKTxAddOutput arg_conv;
37507         arg_conv.inner = untag_ptr(arg);
37508         arg_conv.is_owned = ptr_is_owned(arg);
37509         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37510         arg_conv.is_owned = false;
37511         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
37512         return ret_conv;
37513 }
37514
37515 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
37516         LDKTxAddOutput orig_conv;
37517         orig_conv.inner = untag_ptr(orig);
37518         orig_conv.is_owned = ptr_is_owned(orig);
37519         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37520         orig_conv.is_owned = false;
37521         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
37522         uint64_t ret_ref = 0;
37523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37525         return ret_ref;
37526 }
37527
37528 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
37529         LDKTxAddOutput a_conv;
37530         a_conv.inner = untag_ptr(a);
37531         a_conv.is_owned = ptr_is_owned(a);
37532         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37533         a_conv.is_owned = false;
37534         LDKTxAddOutput b_conv;
37535         b_conv.inner = untag_ptr(b);
37536         b_conv.is_owned = ptr_is_owned(b);
37537         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37538         b_conv.is_owned = false;
37539         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
37540         return ret_conv;
37541 }
37542
37543 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
37544         LDKTxRemoveInput this_obj_conv;
37545         this_obj_conv.inner = untag_ptr(this_obj);
37546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37548         TxRemoveInput_free(this_obj_conv);
37549 }
37550
37551 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
37552         LDKTxRemoveInput this_ptr_conv;
37553         this_ptr_conv.inner = untag_ptr(this_ptr);
37554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37556         this_ptr_conv.is_owned = false;
37557         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37558         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
37559         return ret_arr;
37560 }
37561
37562 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37563         LDKTxRemoveInput this_ptr_conv;
37564         this_ptr_conv.inner = untag_ptr(this_ptr);
37565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37567         this_ptr_conv.is_owned = false;
37568         LDKThirtyTwoBytes val_ref;
37569         CHECK(val->arr_len == 32);
37570         memcpy(val_ref.data, val->elems, 32); FREE(val);
37571         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
37572 }
37573
37574 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
37575         LDKTxRemoveInput this_ptr_conv;
37576         this_ptr_conv.inner = untag_ptr(this_ptr);
37577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37579         this_ptr_conv.is_owned = false;
37580         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
37581         return ret_conv;
37582 }
37583
37584 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
37585         LDKTxRemoveInput this_ptr_conv;
37586         this_ptr_conv.inner = untag_ptr(this_ptr);
37587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37589         this_ptr_conv.is_owned = false;
37590         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
37591 }
37592
37593 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
37594         LDKThirtyTwoBytes channel_id_arg_ref;
37595         CHECK(channel_id_arg->arr_len == 32);
37596         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37597         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
37598         uint64_t ret_ref = 0;
37599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37601         return ret_ref;
37602 }
37603
37604 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
37605         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
37606         uint64_t ret_ref = 0;
37607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37609         return ret_ref;
37610 }
37611 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
37612         LDKTxRemoveInput arg_conv;
37613         arg_conv.inner = untag_ptr(arg);
37614         arg_conv.is_owned = ptr_is_owned(arg);
37615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37616         arg_conv.is_owned = false;
37617         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
37618         return ret_conv;
37619 }
37620
37621 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
37622         LDKTxRemoveInput orig_conv;
37623         orig_conv.inner = untag_ptr(orig);
37624         orig_conv.is_owned = ptr_is_owned(orig);
37625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37626         orig_conv.is_owned = false;
37627         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
37628         uint64_t ret_ref = 0;
37629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37631         return ret_ref;
37632 }
37633
37634 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
37635         LDKTxRemoveInput a_conv;
37636         a_conv.inner = untag_ptr(a);
37637         a_conv.is_owned = ptr_is_owned(a);
37638         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37639         a_conv.is_owned = false;
37640         LDKTxRemoveInput b_conv;
37641         b_conv.inner = untag_ptr(b);
37642         b_conv.is_owned = ptr_is_owned(b);
37643         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37644         b_conv.is_owned = false;
37645         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
37646         return ret_conv;
37647 }
37648
37649 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
37650         LDKTxRemoveOutput this_obj_conv;
37651         this_obj_conv.inner = untag_ptr(this_obj);
37652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37654         TxRemoveOutput_free(this_obj_conv);
37655 }
37656
37657 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
37658         LDKTxRemoveOutput this_ptr_conv;
37659         this_ptr_conv.inner = untag_ptr(this_ptr);
37660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37662         this_ptr_conv.is_owned = false;
37663         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37664         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
37665         return ret_arr;
37666 }
37667
37668 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37669         LDKTxRemoveOutput this_ptr_conv;
37670         this_ptr_conv.inner = untag_ptr(this_ptr);
37671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37673         this_ptr_conv.is_owned = false;
37674         LDKThirtyTwoBytes val_ref;
37675         CHECK(val->arr_len == 32);
37676         memcpy(val_ref.data, val->elems, 32); FREE(val);
37677         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
37678 }
37679
37680 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
37681         LDKTxRemoveOutput this_ptr_conv;
37682         this_ptr_conv.inner = untag_ptr(this_ptr);
37683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37685         this_ptr_conv.is_owned = false;
37686         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
37687         return ret_conv;
37688 }
37689
37690 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
37691         LDKTxRemoveOutput this_ptr_conv;
37692         this_ptr_conv.inner = untag_ptr(this_ptr);
37693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37695         this_ptr_conv.is_owned = false;
37696         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
37697 }
37698
37699 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
37700         LDKThirtyTwoBytes channel_id_arg_ref;
37701         CHECK(channel_id_arg->arr_len == 32);
37702         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37703         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
37704         uint64_t ret_ref = 0;
37705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37707         return ret_ref;
37708 }
37709
37710 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
37711         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
37712         uint64_t ret_ref = 0;
37713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37715         return ret_ref;
37716 }
37717 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
37718         LDKTxRemoveOutput arg_conv;
37719         arg_conv.inner = untag_ptr(arg);
37720         arg_conv.is_owned = ptr_is_owned(arg);
37721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37722         arg_conv.is_owned = false;
37723         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
37724         return ret_conv;
37725 }
37726
37727 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
37728         LDKTxRemoveOutput orig_conv;
37729         orig_conv.inner = untag_ptr(orig);
37730         orig_conv.is_owned = ptr_is_owned(orig);
37731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37732         orig_conv.is_owned = false;
37733         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
37734         uint64_t ret_ref = 0;
37735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37737         return ret_ref;
37738 }
37739
37740 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
37741         LDKTxRemoveOutput a_conv;
37742         a_conv.inner = untag_ptr(a);
37743         a_conv.is_owned = ptr_is_owned(a);
37744         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37745         a_conv.is_owned = false;
37746         LDKTxRemoveOutput b_conv;
37747         b_conv.inner = untag_ptr(b);
37748         b_conv.is_owned = ptr_is_owned(b);
37749         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37750         b_conv.is_owned = false;
37751         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
37752         return ret_conv;
37753 }
37754
37755 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
37756         LDKTxComplete this_obj_conv;
37757         this_obj_conv.inner = untag_ptr(this_obj);
37758         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37760         TxComplete_free(this_obj_conv);
37761 }
37762
37763 int8_tArray  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
37764         LDKTxComplete this_ptr_conv;
37765         this_ptr_conv.inner = untag_ptr(this_ptr);
37766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37768         this_ptr_conv.is_owned = false;
37769         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37770         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
37771         return ret_arr;
37772 }
37773
37774 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37775         LDKTxComplete this_ptr_conv;
37776         this_ptr_conv.inner = untag_ptr(this_ptr);
37777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37779         this_ptr_conv.is_owned = false;
37780         LDKThirtyTwoBytes val_ref;
37781         CHECK(val->arr_len == 32);
37782         memcpy(val_ref.data, val->elems, 32); FREE(val);
37783         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
37784 }
37785
37786 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(int8_tArray channel_id_arg) {
37787         LDKThirtyTwoBytes channel_id_arg_ref;
37788         CHECK(channel_id_arg->arr_len == 32);
37789         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37790         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
37791         uint64_t ret_ref = 0;
37792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37794         return ret_ref;
37795 }
37796
37797 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
37798         LDKTxComplete ret_var = TxComplete_clone(arg);
37799         uint64_t ret_ref = 0;
37800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37802         return ret_ref;
37803 }
37804 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
37805         LDKTxComplete arg_conv;
37806         arg_conv.inner = untag_ptr(arg);
37807         arg_conv.is_owned = ptr_is_owned(arg);
37808         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37809         arg_conv.is_owned = false;
37810         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
37811         return ret_conv;
37812 }
37813
37814 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
37815         LDKTxComplete orig_conv;
37816         orig_conv.inner = untag_ptr(orig);
37817         orig_conv.is_owned = ptr_is_owned(orig);
37818         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37819         orig_conv.is_owned = false;
37820         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
37821         uint64_t ret_ref = 0;
37822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37824         return ret_ref;
37825 }
37826
37827 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
37828         LDKTxComplete a_conv;
37829         a_conv.inner = untag_ptr(a);
37830         a_conv.is_owned = ptr_is_owned(a);
37831         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37832         a_conv.is_owned = false;
37833         LDKTxComplete b_conv;
37834         b_conv.inner = untag_ptr(b);
37835         b_conv.is_owned = ptr_is_owned(b);
37836         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37837         b_conv.is_owned = false;
37838         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
37839         return ret_conv;
37840 }
37841
37842 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
37843         LDKTxSignatures this_obj_conv;
37844         this_obj_conv.inner = untag_ptr(this_obj);
37845         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37847         TxSignatures_free(this_obj_conv);
37848 }
37849
37850 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
37851         LDKTxSignatures this_ptr_conv;
37852         this_ptr_conv.inner = untag_ptr(this_ptr);
37853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37855         this_ptr_conv.is_owned = false;
37856         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37857         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
37858         return ret_arr;
37859 }
37860
37861 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37862         LDKTxSignatures this_ptr_conv;
37863         this_ptr_conv.inner = untag_ptr(this_ptr);
37864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37866         this_ptr_conv.is_owned = false;
37867         LDKThirtyTwoBytes val_ref;
37868         CHECK(val->arr_len == 32);
37869         memcpy(val_ref.data, val->elems, 32); FREE(val);
37870         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
37871 }
37872
37873 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
37874         LDKTxSignatures this_ptr_conv;
37875         this_ptr_conv.inner = untag_ptr(this_ptr);
37876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37878         this_ptr_conv.is_owned = false;
37879         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37880         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
37881         return ret_arr;
37882 }
37883
37884 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
37885         LDKTxSignatures this_ptr_conv;
37886         this_ptr_conv.inner = untag_ptr(this_ptr);
37887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37889         this_ptr_conv.is_owned = false;
37890         LDKThirtyTwoBytes val_ref;
37891         CHECK(val->arr_len == 32);
37892         memcpy(val_ref.data, val->elems, 32); FREE(val);
37893         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
37894 }
37895
37896 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
37897         LDKTxSignatures this_ptr_conv;
37898         this_ptr_conv.inner = untag_ptr(this_ptr);
37899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37901         this_ptr_conv.is_owned = false;
37902         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
37903         ptrArray ret_arr = NULL;
37904         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
37905         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
37906         for (size_t m = 0; m < ret_var.datalen; m++) {
37907                 LDKWitness ret_conv_12_var = ret_var.data[m];
37908                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
37909                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
37910                 Witness_free(ret_conv_12_var);
37911                 ret_arr_ptr[m] = ret_conv_12_arr;
37912         }
37913         
37914         FREE(ret_var.data);
37915         return ret_arr;
37916 }
37917
37918 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
37919         LDKTxSignatures this_ptr_conv;
37920         this_ptr_conv.inner = untag_ptr(this_ptr);
37921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37923         this_ptr_conv.is_owned = false;
37924         LDKCVec_WitnessZ val_constr;
37925         val_constr.datalen = val->arr_len;
37926         if (val_constr.datalen > 0)
37927                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
37928         else
37929                 val_constr.data = NULL;
37930         int8_tArray* val_vals = (void*) val->elems;
37931         for (size_t m = 0; m < val_constr.datalen; m++) {
37932                 int8_tArray val_conv_12 = val_vals[m];
37933                 LDKWitness val_conv_12_ref;
37934                 val_conv_12_ref.datalen = val_conv_12->arr_len;
37935                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
37936                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
37937                 val_conv_12_ref.data_is_owned = true;
37938                 val_constr.data[m] = val_conv_12_ref;
37939         }
37940         FREE(val);
37941         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
37942 }
37943
37944 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
37945         LDKThirtyTwoBytes channel_id_arg_ref;
37946         CHECK(channel_id_arg->arr_len == 32);
37947         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37948         LDKThirtyTwoBytes tx_hash_arg_ref;
37949         CHECK(tx_hash_arg->arr_len == 32);
37950         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
37951         LDKCVec_WitnessZ witnesses_arg_constr;
37952         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
37953         if (witnesses_arg_constr.datalen > 0)
37954                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
37955         else
37956                 witnesses_arg_constr.data = NULL;
37957         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
37958         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
37959                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
37960                 LDKWitness witnesses_arg_conv_12_ref;
37961                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
37962                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
37963                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
37964                 witnesses_arg_conv_12_ref.data_is_owned = true;
37965                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
37966         }
37967         FREE(witnesses_arg);
37968         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
37969         uint64_t ret_ref = 0;
37970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37972         return ret_ref;
37973 }
37974
37975 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
37976         LDKTxSignatures ret_var = TxSignatures_clone(arg);
37977         uint64_t ret_ref = 0;
37978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37980         return ret_ref;
37981 }
37982 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
37983         LDKTxSignatures arg_conv;
37984         arg_conv.inner = untag_ptr(arg);
37985         arg_conv.is_owned = ptr_is_owned(arg);
37986         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37987         arg_conv.is_owned = false;
37988         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
37989         return ret_conv;
37990 }
37991
37992 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
37993         LDKTxSignatures orig_conv;
37994         orig_conv.inner = untag_ptr(orig);
37995         orig_conv.is_owned = ptr_is_owned(orig);
37996         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37997         orig_conv.is_owned = false;
37998         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
37999         uint64_t ret_ref = 0;
38000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38002         return ret_ref;
38003 }
38004
38005 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
38006         LDKTxSignatures a_conv;
38007         a_conv.inner = untag_ptr(a);
38008         a_conv.is_owned = ptr_is_owned(a);
38009         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38010         a_conv.is_owned = false;
38011         LDKTxSignatures b_conv;
38012         b_conv.inner = untag_ptr(b);
38013         b_conv.is_owned = ptr_is_owned(b);
38014         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38015         b_conv.is_owned = false;
38016         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
38017         return ret_conv;
38018 }
38019
38020 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
38021         LDKTxInitRbf this_obj_conv;
38022         this_obj_conv.inner = untag_ptr(this_obj);
38023         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38025         TxInitRbf_free(this_obj_conv);
38026 }
38027
38028 int8_tArray  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
38029         LDKTxInitRbf this_ptr_conv;
38030         this_ptr_conv.inner = untag_ptr(this_ptr);
38031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38033         this_ptr_conv.is_owned = false;
38034         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38035         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
38036         return ret_arr;
38037 }
38038
38039 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38040         LDKTxInitRbf this_ptr_conv;
38041         this_ptr_conv.inner = untag_ptr(this_ptr);
38042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38044         this_ptr_conv.is_owned = false;
38045         LDKThirtyTwoBytes val_ref;
38046         CHECK(val->arr_len == 32);
38047         memcpy(val_ref.data, val->elems, 32); FREE(val);
38048         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
38049 }
38050
38051 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
38052         LDKTxInitRbf this_ptr_conv;
38053         this_ptr_conv.inner = untag_ptr(this_ptr);
38054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38056         this_ptr_conv.is_owned = false;
38057         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
38058         return ret_conv;
38059 }
38060
38061 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
38062         LDKTxInitRbf this_ptr_conv;
38063         this_ptr_conv.inner = untag_ptr(this_ptr);
38064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38066         this_ptr_conv.is_owned = false;
38067         TxInitRbf_set_locktime(&this_ptr_conv, val);
38068 }
38069
38070 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) {
38071         LDKTxInitRbf this_ptr_conv;
38072         this_ptr_conv.inner = untag_ptr(this_ptr);
38073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38075         this_ptr_conv.is_owned = false;
38076         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
38077         return ret_conv;
38078 }
38079
38080 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) {
38081         LDKTxInitRbf this_ptr_conv;
38082         this_ptr_conv.inner = untag_ptr(this_ptr);
38083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38085         this_ptr_conv.is_owned = false;
38086         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
38087 }
38088
38089 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
38090         LDKTxInitRbf this_ptr_conv;
38091         this_ptr_conv.inner = untag_ptr(this_ptr);
38092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38094         this_ptr_conv.is_owned = false;
38095         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
38096         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
38097         uint64_t ret_ref = tag_ptr(ret_copy, true);
38098         return ret_ref;
38099 }
38100
38101 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
38102         LDKTxInitRbf this_ptr_conv;
38103         this_ptr_conv.inner = untag_ptr(this_ptr);
38104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38106         this_ptr_conv.is_owned = false;
38107         void* val_ptr = untag_ptr(val);
38108         CHECK_ACCESS(val_ptr);
38109         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
38110         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
38111         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
38112 }
38113
38114 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) {
38115         LDKThirtyTwoBytes channel_id_arg_ref;
38116         CHECK(channel_id_arg->arr_len == 32);
38117         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38118         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
38119         CHECK_ACCESS(funding_output_contribution_arg_ptr);
38120         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
38121         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
38122         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
38123         uint64_t ret_ref = 0;
38124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38126         return ret_ref;
38127 }
38128
38129 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
38130         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
38131         uint64_t ret_ref = 0;
38132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38134         return ret_ref;
38135 }
38136 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
38137         LDKTxInitRbf arg_conv;
38138         arg_conv.inner = untag_ptr(arg);
38139         arg_conv.is_owned = ptr_is_owned(arg);
38140         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38141         arg_conv.is_owned = false;
38142         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
38143         return ret_conv;
38144 }
38145
38146 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
38147         LDKTxInitRbf orig_conv;
38148         orig_conv.inner = untag_ptr(orig);
38149         orig_conv.is_owned = ptr_is_owned(orig);
38150         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38151         orig_conv.is_owned = false;
38152         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
38153         uint64_t ret_ref = 0;
38154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38156         return ret_ref;
38157 }
38158
38159 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
38160         LDKTxInitRbf a_conv;
38161         a_conv.inner = untag_ptr(a);
38162         a_conv.is_owned = ptr_is_owned(a);
38163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38164         a_conv.is_owned = false;
38165         LDKTxInitRbf b_conv;
38166         b_conv.inner = untag_ptr(b);
38167         b_conv.is_owned = ptr_is_owned(b);
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38169         b_conv.is_owned = false;
38170         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
38171         return ret_conv;
38172 }
38173
38174 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
38175         LDKTxAckRbf this_obj_conv;
38176         this_obj_conv.inner = untag_ptr(this_obj);
38177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38179         TxAckRbf_free(this_obj_conv);
38180 }
38181
38182 int8_tArray  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
38183         LDKTxAckRbf this_ptr_conv;
38184         this_ptr_conv.inner = untag_ptr(this_ptr);
38185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38187         this_ptr_conv.is_owned = false;
38188         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38189         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
38190         return ret_arr;
38191 }
38192
38193 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38194         LDKTxAckRbf this_ptr_conv;
38195         this_ptr_conv.inner = untag_ptr(this_ptr);
38196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38198         this_ptr_conv.is_owned = false;
38199         LDKThirtyTwoBytes val_ref;
38200         CHECK(val->arr_len == 32);
38201         memcpy(val_ref.data, val->elems, 32); FREE(val);
38202         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
38203 }
38204
38205 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
38206         LDKTxAckRbf this_ptr_conv;
38207         this_ptr_conv.inner = untag_ptr(this_ptr);
38208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38210         this_ptr_conv.is_owned = false;
38211         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
38212         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
38213         uint64_t ret_ref = tag_ptr(ret_copy, true);
38214         return ret_ref;
38215 }
38216
38217 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
38218         LDKTxAckRbf this_ptr_conv;
38219         this_ptr_conv.inner = untag_ptr(this_ptr);
38220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38222         this_ptr_conv.is_owned = false;
38223         void* val_ptr = untag_ptr(val);
38224         CHECK_ACCESS(val_ptr);
38225         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
38226         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
38227         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
38228 }
38229
38230 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(int8_tArray channel_id_arg, uint64_t funding_output_contribution_arg) {
38231         LDKThirtyTwoBytes channel_id_arg_ref;
38232         CHECK(channel_id_arg->arr_len == 32);
38233         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38234         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
38235         CHECK_ACCESS(funding_output_contribution_arg_ptr);
38236         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
38237         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
38238         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
38239         uint64_t ret_ref = 0;
38240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38242         return ret_ref;
38243 }
38244
38245 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
38246         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
38247         uint64_t ret_ref = 0;
38248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38250         return ret_ref;
38251 }
38252 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
38253         LDKTxAckRbf arg_conv;
38254         arg_conv.inner = untag_ptr(arg);
38255         arg_conv.is_owned = ptr_is_owned(arg);
38256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38257         arg_conv.is_owned = false;
38258         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
38259         return ret_conv;
38260 }
38261
38262 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
38263         LDKTxAckRbf orig_conv;
38264         orig_conv.inner = untag_ptr(orig);
38265         orig_conv.is_owned = ptr_is_owned(orig);
38266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38267         orig_conv.is_owned = false;
38268         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
38269         uint64_t ret_ref = 0;
38270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38272         return ret_ref;
38273 }
38274
38275 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
38276         LDKTxAckRbf a_conv;
38277         a_conv.inner = untag_ptr(a);
38278         a_conv.is_owned = ptr_is_owned(a);
38279         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38280         a_conv.is_owned = false;
38281         LDKTxAckRbf b_conv;
38282         b_conv.inner = untag_ptr(b);
38283         b_conv.is_owned = ptr_is_owned(b);
38284         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38285         b_conv.is_owned = false;
38286         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
38287         return ret_conv;
38288 }
38289
38290 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
38291         LDKTxAbort this_obj_conv;
38292         this_obj_conv.inner = untag_ptr(this_obj);
38293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38295         TxAbort_free(this_obj_conv);
38296 }
38297
38298 int8_tArray  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
38299         LDKTxAbort this_ptr_conv;
38300         this_ptr_conv.inner = untag_ptr(this_ptr);
38301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38303         this_ptr_conv.is_owned = false;
38304         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38305         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
38306         return ret_arr;
38307 }
38308
38309 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38310         LDKTxAbort this_ptr_conv;
38311         this_ptr_conv.inner = untag_ptr(this_ptr);
38312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38314         this_ptr_conv.is_owned = false;
38315         LDKThirtyTwoBytes val_ref;
38316         CHECK(val->arr_len == 32);
38317         memcpy(val_ref.data, val->elems, 32); FREE(val);
38318         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
38319 }
38320
38321 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
38322         LDKTxAbort this_ptr_conv;
38323         this_ptr_conv.inner = untag_ptr(this_ptr);
38324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38326         this_ptr_conv.is_owned = false;
38327         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
38328         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38329         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38330         CVec_u8Z_free(ret_var);
38331         return ret_arr;
38332 }
38333
38334 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
38335         LDKTxAbort this_ptr_conv;
38336         this_ptr_conv.inner = untag_ptr(this_ptr);
38337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38339         this_ptr_conv.is_owned = false;
38340         LDKCVec_u8Z val_ref;
38341         val_ref.datalen = val->arr_len;
38342         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38343         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38344         TxAbort_set_data(&this_ptr_conv, val_ref);
38345 }
38346
38347 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
38348         LDKThirtyTwoBytes channel_id_arg_ref;
38349         CHECK(channel_id_arg->arr_len == 32);
38350         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38351         LDKCVec_u8Z data_arg_ref;
38352         data_arg_ref.datalen = data_arg->arr_len;
38353         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38354         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
38355         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
38356         uint64_t ret_ref = 0;
38357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38359         return ret_ref;
38360 }
38361
38362 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
38363         LDKTxAbort ret_var = TxAbort_clone(arg);
38364         uint64_t ret_ref = 0;
38365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38367         return ret_ref;
38368 }
38369 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
38370         LDKTxAbort arg_conv;
38371         arg_conv.inner = untag_ptr(arg);
38372         arg_conv.is_owned = ptr_is_owned(arg);
38373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38374         arg_conv.is_owned = false;
38375         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
38376         return ret_conv;
38377 }
38378
38379 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
38380         LDKTxAbort orig_conv;
38381         orig_conv.inner = untag_ptr(orig);
38382         orig_conv.is_owned = ptr_is_owned(orig);
38383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38384         orig_conv.is_owned = false;
38385         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
38386         uint64_t ret_ref = 0;
38387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38389         return ret_ref;
38390 }
38391
38392 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
38393         LDKTxAbort a_conv;
38394         a_conv.inner = untag_ptr(a);
38395         a_conv.is_owned = ptr_is_owned(a);
38396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38397         a_conv.is_owned = false;
38398         LDKTxAbort b_conv;
38399         b_conv.inner = untag_ptr(b);
38400         b_conv.is_owned = ptr_is_owned(b);
38401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38402         b_conv.is_owned = false;
38403         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
38404         return ret_conv;
38405 }
38406
38407 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
38408         LDKShutdown this_obj_conv;
38409         this_obj_conv.inner = untag_ptr(this_obj);
38410         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38412         Shutdown_free(this_obj_conv);
38413 }
38414
38415 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
38416         LDKShutdown this_ptr_conv;
38417         this_ptr_conv.inner = untag_ptr(this_ptr);
38418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38420         this_ptr_conv.is_owned = false;
38421         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38422         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
38423         return ret_arr;
38424 }
38425
38426 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38427         LDKShutdown this_ptr_conv;
38428         this_ptr_conv.inner = untag_ptr(this_ptr);
38429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38431         this_ptr_conv.is_owned = false;
38432         LDKThirtyTwoBytes val_ref;
38433         CHECK(val->arr_len == 32);
38434         memcpy(val_ref.data, val->elems, 32); FREE(val);
38435         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
38436 }
38437
38438 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
38439         LDKShutdown this_ptr_conv;
38440         this_ptr_conv.inner = untag_ptr(this_ptr);
38441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38443         this_ptr_conv.is_owned = false;
38444         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
38445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38447         return ret_arr;
38448 }
38449
38450 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
38451         LDKShutdown this_ptr_conv;
38452         this_ptr_conv.inner = untag_ptr(this_ptr);
38453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38455         this_ptr_conv.is_owned = false;
38456         LDKCVec_u8Z val_ref;
38457         val_ref.datalen = val->arr_len;
38458         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38459         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38460         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
38461 }
38462
38463 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
38464         LDKThirtyTwoBytes channel_id_arg_ref;
38465         CHECK(channel_id_arg->arr_len == 32);
38466         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38467         LDKCVec_u8Z scriptpubkey_arg_ref;
38468         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
38469         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38470         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
38471         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
38472         uint64_t ret_ref = 0;
38473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38475         return ret_ref;
38476 }
38477
38478 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
38479         LDKShutdown ret_var = Shutdown_clone(arg);
38480         uint64_t ret_ref = 0;
38481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38483         return ret_ref;
38484 }
38485 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
38486         LDKShutdown arg_conv;
38487         arg_conv.inner = untag_ptr(arg);
38488         arg_conv.is_owned = ptr_is_owned(arg);
38489         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38490         arg_conv.is_owned = false;
38491         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
38492         return ret_conv;
38493 }
38494
38495 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
38496         LDKShutdown orig_conv;
38497         orig_conv.inner = untag_ptr(orig);
38498         orig_conv.is_owned = ptr_is_owned(orig);
38499         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38500         orig_conv.is_owned = false;
38501         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
38502         uint64_t ret_ref = 0;
38503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38505         return ret_ref;
38506 }
38507
38508 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
38509         LDKShutdown a_conv;
38510         a_conv.inner = untag_ptr(a);
38511         a_conv.is_owned = ptr_is_owned(a);
38512         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38513         a_conv.is_owned = false;
38514         LDKShutdown b_conv;
38515         b_conv.inner = untag_ptr(b);
38516         b_conv.is_owned = ptr_is_owned(b);
38517         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38518         b_conv.is_owned = false;
38519         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
38520         return ret_conv;
38521 }
38522
38523 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
38524         LDKClosingSignedFeeRange this_obj_conv;
38525         this_obj_conv.inner = untag_ptr(this_obj);
38526         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38528         ClosingSignedFeeRange_free(this_obj_conv);
38529 }
38530
38531 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
38532         LDKClosingSignedFeeRange this_ptr_conv;
38533         this_ptr_conv.inner = untag_ptr(this_ptr);
38534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38536         this_ptr_conv.is_owned = false;
38537         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
38538         return ret_conv;
38539 }
38540
38541 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
38542         LDKClosingSignedFeeRange this_ptr_conv;
38543         this_ptr_conv.inner = untag_ptr(this_ptr);
38544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38546         this_ptr_conv.is_owned = false;
38547         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
38548 }
38549
38550 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
38551         LDKClosingSignedFeeRange this_ptr_conv;
38552         this_ptr_conv.inner = untag_ptr(this_ptr);
38553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38555         this_ptr_conv.is_owned = false;
38556         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
38557         return ret_conv;
38558 }
38559
38560 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
38561         LDKClosingSignedFeeRange this_ptr_conv;
38562         this_ptr_conv.inner = untag_ptr(this_ptr);
38563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38565         this_ptr_conv.is_owned = false;
38566         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
38567 }
38568
38569 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
38570         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
38571         uint64_t ret_ref = 0;
38572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38574         return ret_ref;
38575 }
38576
38577 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
38578         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
38579         uint64_t ret_ref = 0;
38580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38582         return ret_ref;
38583 }
38584 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
38585         LDKClosingSignedFeeRange arg_conv;
38586         arg_conv.inner = untag_ptr(arg);
38587         arg_conv.is_owned = ptr_is_owned(arg);
38588         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38589         arg_conv.is_owned = false;
38590         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
38591         return ret_conv;
38592 }
38593
38594 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
38595         LDKClosingSignedFeeRange orig_conv;
38596         orig_conv.inner = untag_ptr(orig);
38597         orig_conv.is_owned = ptr_is_owned(orig);
38598         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38599         orig_conv.is_owned = false;
38600         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
38601         uint64_t ret_ref = 0;
38602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38604         return ret_ref;
38605 }
38606
38607 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
38608         LDKClosingSignedFeeRange a_conv;
38609         a_conv.inner = untag_ptr(a);
38610         a_conv.is_owned = ptr_is_owned(a);
38611         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38612         a_conv.is_owned = false;
38613         LDKClosingSignedFeeRange b_conv;
38614         b_conv.inner = untag_ptr(b);
38615         b_conv.is_owned = ptr_is_owned(b);
38616         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38617         b_conv.is_owned = false;
38618         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
38619         return ret_conv;
38620 }
38621
38622 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
38623         LDKClosingSigned this_obj_conv;
38624         this_obj_conv.inner = untag_ptr(this_obj);
38625         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38627         ClosingSigned_free(this_obj_conv);
38628 }
38629
38630 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
38631         LDKClosingSigned this_ptr_conv;
38632         this_ptr_conv.inner = untag_ptr(this_ptr);
38633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38635         this_ptr_conv.is_owned = false;
38636         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38637         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
38638         return ret_arr;
38639 }
38640
38641 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38642         LDKClosingSigned this_ptr_conv;
38643         this_ptr_conv.inner = untag_ptr(this_ptr);
38644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38646         this_ptr_conv.is_owned = false;
38647         LDKThirtyTwoBytes val_ref;
38648         CHECK(val->arr_len == 32);
38649         memcpy(val_ref.data, val->elems, 32); FREE(val);
38650         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
38651 }
38652
38653 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
38654         LDKClosingSigned this_ptr_conv;
38655         this_ptr_conv.inner = untag_ptr(this_ptr);
38656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38658         this_ptr_conv.is_owned = false;
38659         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
38660         return ret_conv;
38661 }
38662
38663 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
38664         LDKClosingSigned this_ptr_conv;
38665         this_ptr_conv.inner = untag_ptr(this_ptr);
38666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38668         this_ptr_conv.is_owned = false;
38669         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
38670 }
38671
38672 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
38673         LDKClosingSigned this_ptr_conv;
38674         this_ptr_conv.inner = untag_ptr(this_ptr);
38675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38677         this_ptr_conv.is_owned = false;
38678         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
38679         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
38680         return ret_arr;
38681 }
38682
38683 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
38684         LDKClosingSigned this_ptr_conv;
38685         this_ptr_conv.inner = untag_ptr(this_ptr);
38686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38688         this_ptr_conv.is_owned = false;
38689         LDKSignature val_ref;
38690         CHECK(val->arr_len == 64);
38691         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
38692         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
38693 }
38694
38695 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
38696         LDKClosingSigned this_ptr_conv;
38697         this_ptr_conv.inner = untag_ptr(this_ptr);
38698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38700         this_ptr_conv.is_owned = false;
38701         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
38702         uint64_t ret_ref = 0;
38703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38705         return ret_ref;
38706 }
38707
38708 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
38709         LDKClosingSigned this_ptr_conv;
38710         this_ptr_conv.inner = untag_ptr(this_ptr);
38711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38713         this_ptr_conv.is_owned = false;
38714         LDKClosingSignedFeeRange val_conv;
38715         val_conv.inner = untag_ptr(val);
38716         val_conv.is_owned = ptr_is_owned(val);
38717         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38718         val_conv = ClosingSignedFeeRange_clone(&val_conv);
38719         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
38720 }
38721
38722 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) {
38723         LDKThirtyTwoBytes channel_id_arg_ref;
38724         CHECK(channel_id_arg->arr_len == 32);
38725         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38726         LDKSignature signature_arg_ref;
38727         CHECK(signature_arg->arr_len == 64);
38728         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
38729         LDKClosingSignedFeeRange fee_range_arg_conv;
38730         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
38731         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
38732         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
38733         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
38734         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
38735         uint64_t ret_ref = 0;
38736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38738         return ret_ref;
38739 }
38740
38741 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
38742         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
38743         uint64_t ret_ref = 0;
38744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38746         return ret_ref;
38747 }
38748 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
38749         LDKClosingSigned arg_conv;
38750         arg_conv.inner = untag_ptr(arg);
38751         arg_conv.is_owned = ptr_is_owned(arg);
38752         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38753         arg_conv.is_owned = false;
38754         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
38755         return ret_conv;
38756 }
38757
38758 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
38759         LDKClosingSigned orig_conv;
38760         orig_conv.inner = untag_ptr(orig);
38761         orig_conv.is_owned = ptr_is_owned(orig);
38762         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38763         orig_conv.is_owned = false;
38764         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
38765         uint64_t ret_ref = 0;
38766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38768         return ret_ref;
38769 }
38770
38771 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
38772         LDKClosingSigned a_conv;
38773         a_conv.inner = untag_ptr(a);
38774         a_conv.is_owned = ptr_is_owned(a);
38775         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38776         a_conv.is_owned = false;
38777         LDKClosingSigned b_conv;
38778         b_conv.inner = untag_ptr(b);
38779         b_conv.is_owned = ptr_is_owned(b);
38780         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38781         b_conv.is_owned = false;
38782         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
38783         return ret_conv;
38784 }
38785
38786 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
38787         LDKUpdateAddHTLC this_obj_conv;
38788         this_obj_conv.inner = untag_ptr(this_obj);
38789         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38791         UpdateAddHTLC_free(this_obj_conv);
38792 }
38793
38794 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
38795         LDKUpdateAddHTLC this_ptr_conv;
38796         this_ptr_conv.inner = untag_ptr(this_ptr);
38797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38799         this_ptr_conv.is_owned = false;
38800         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38801         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
38802         return ret_arr;
38803 }
38804
38805 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38806         LDKUpdateAddHTLC this_ptr_conv;
38807         this_ptr_conv.inner = untag_ptr(this_ptr);
38808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38810         this_ptr_conv.is_owned = false;
38811         LDKThirtyTwoBytes val_ref;
38812         CHECK(val->arr_len == 32);
38813         memcpy(val_ref.data, val->elems, 32); FREE(val);
38814         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
38815 }
38816
38817 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
38818         LDKUpdateAddHTLC this_ptr_conv;
38819         this_ptr_conv.inner = untag_ptr(this_ptr);
38820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38822         this_ptr_conv.is_owned = false;
38823         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
38824         return ret_conv;
38825 }
38826
38827 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
38828         LDKUpdateAddHTLC this_ptr_conv;
38829         this_ptr_conv.inner = untag_ptr(this_ptr);
38830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38832         this_ptr_conv.is_owned = false;
38833         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
38834 }
38835
38836 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
38837         LDKUpdateAddHTLC this_ptr_conv;
38838         this_ptr_conv.inner = untag_ptr(this_ptr);
38839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38841         this_ptr_conv.is_owned = false;
38842         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
38843         return ret_conv;
38844 }
38845
38846 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
38847         LDKUpdateAddHTLC this_ptr_conv;
38848         this_ptr_conv.inner = untag_ptr(this_ptr);
38849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38851         this_ptr_conv.is_owned = false;
38852         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
38853 }
38854
38855 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
38856         LDKUpdateAddHTLC this_ptr_conv;
38857         this_ptr_conv.inner = untag_ptr(this_ptr);
38858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38860         this_ptr_conv.is_owned = false;
38861         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38862         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
38863         return ret_arr;
38864 }
38865
38866 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
38867         LDKUpdateAddHTLC this_ptr_conv;
38868         this_ptr_conv.inner = untag_ptr(this_ptr);
38869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38871         this_ptr_conv.is_owned = false;
38872         LDKThirtyTwoBytes val_ref;
38873         CHECK(val->arr_len == 32);
38874         memcpy(val_ref.data, val->elems, 32); FREE(val);
38875         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
38876 }
38877
38878 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
38879         LDKUpdateAddHTLC this_ptr_conv;
38880         this_ptr_conv.inner = untag_ptr(this_ptr);
38881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38883         this_ptr_conv.is_owned = false;
38884         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
38885         return ret_conv;
38886 }
38887
38888 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
38889         LDKUpdateAddHTLC this_ptr_conv;
38890         this_ptr_conv.inner = untag_ptr(this_ptr);
38891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38893         this_ptr_conv.is_owned = false;
38894         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
38895 }
38896
38897 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
38898         LDKUpdateAddHTLC this_ptr_conv;
38899         this_ptr_conv.inner = untag_ptr(this_ptr);
38900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38902         this_ptr_conv.is_owned = false;
38903         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38904         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
38905         uint64_t ret_ref = tag_ptr(ret_copy, true);
38906         return ret_ref;
38907 }
38908
38909 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
38910         LDKUpdateAddHTLC this_ptr_conv;
38911         this_ptr_conv.inner = untag_ptr(this_ptr);
38912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38914         this_ptr_conv.is_owned = false;
38915         void* val_ptr = untag_ptr(val);
38916         CHECK_ACCESS(val_ptr);
38917         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38918         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38919         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
38920 }
38921
38922 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
38923         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
38924         uint64_t ret_ref = 0;
38925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38927         return ret_ref;
38928 }
38929 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
38930         LDKUpdateAddHTLC arg_conv;
38931         arg_conv.inner = untag_ptr(arg);
38932         arg_conv.is_owned = ptr_is_owned(arg);
38933         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38934         arg_conv.is_owned = false;
38935         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
38936         return ret_conv;
38937 }
38938
38939 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
38940         LDKUpdateAddHTLC orig_conv;
38941         orig_conv.inner = untag_ptr(orig);
38942         orig_conv.is_owned = ptr_is_owned(orig);
38943         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38944         orig_conv.is_owned = false;
38945         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
38946         uint64_t ret_ref = 0;
38947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38949         return ret_ref;
38950 }
38951
38952 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
38953         LDKUpdateAddHTLC a_conv;
38954         a_conv.inner = untag_ptr(a);
38955         a_conv.is_owned = ptr_is_owned(a);
38956         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38957         a_conv.is_owned = false;
38958         LDKUpdateAddHTLC b_conv;
38959         b_conv.inner = untag_ptr(b);
38960         b_conv.is_owned = ptr_is_owned(b);
38961         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38962         b_conv.is_owned = false;
38963         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
38964         return ret_conv;
38965 }
38966
38967 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
38968         LDKOnionMessage this_obj_conv;
38969         this_obj_conv.inner = untag_ptr(this_obj);
38970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38972         OnionMessage_free(this_obj_conv);
38973 }
38974
38975 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
38976         LDKOnionMessage this_ptr_conv;
38977         this_ptr_conv.inner = untag_ptr(this_ptr);
38978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38980         this_ptr_conv.is_owned = false;
38981         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38982         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
38983         return ret_arr;
38984 }
38985
38986 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
38987         LDKOnionMessage this_ptr_conv;
38988         this_ptr_conv.inner = untag_ptr(this_ptr);
38989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38991         this_ptr_conv.is_owned = false;
38992         LDKPublicKey val_ref;
38993         CHECK(val->arr_len == 33);
38994         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38995         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
38996 }
38997
38998 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
38999         LDKOnionMessage ret_var = OnionMessage_clone(arg);
39000         uint64_t ret_ref = 0;
39001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39003         return ret_ref;
39004 }
39005 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
39006         LDKOnionMessage arg_conv;
39007         arg_conv.inner = untag_ptr(arg);
39008         arg_conv.is_owned = ptr_is_owned(arg);
39009         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39010         arg_conv.is_owned = false;
39011         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
39012         return ret_conv;
39013 }
39014
39015 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
39016         LDKOnionMessage orig_conv;
39017         orig_conv.inner = untag_ptr(orig);
39018         orig_conv.is_owned = ptr_is_owned(orig);
39019         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39020         orig_conv.is_owned = false;
39021         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
39022         uint64_t ret_ref = 0;
39023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39025         return ret_ref;
39026 }
39027
39028 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
39029         LDKOnionMessage a_conv;
39030         a_conv.inner = untag_ptr(a);
39031         a_conv.is_owned = ptr_is_owned(a);
39032         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39033         a_conv.is_owned = false;
39034         LDKOnionMessage b_conv;
39035         b_conv.inner = untag_ptr(b);
39036         b_conv.is_owned = ptr_is_owned(b);
39037         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39038         b_conv.is_owned = false;
39039         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
39040         return ret_conv;
39041 }
39042
39043 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
39044         LDKUpdateFulfillHTLC this_obj_conv;
39045         this_obj_conv.inner = untag_ptr(this_obj);
39046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39048         UpdateFulfillHTLC_free(this_obj_conv);
39049 }
39050
39051 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
39052         LDKUpdateFulfillHTLC this_ptr_conv;
39053         this_ptr_conv.inner = untag_ptr(this_ptr);
39054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39056         this_ptr_conv.is_owned = false;
39057         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39058         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
39059         return ret_arr;
39060 }
39061
39062 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39063         LDKUpdateFulfillHTLC this_ptr_conv;
39064         this_ptr_conv.inner = untag_ptr(this_ptr);
39065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39067         this_ptr_conv.is_owned = false;
39068         LDKThirtyTwoBytes val_ref;
39069         CHECK(val->arr_len == 32);
39070         memcpy(val_ref.data, val->elems, 32); FREE(val);
39071         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
39072 }
39073
39074 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
39075         LDKUpdateFulfillHTLC this_ptr_conv;
39076         this_ptr_conv.inner = untag_ptr(this_ptr);
39077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39079         this_ptr_conv.is_owned = false;
39080         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
39081         return ret_conv;
39082 }
39083
39084 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
39085         LDKUpdateFulfillHTLC this_ptr_conv;
39086         this_ptr_conv.inner = untag_ptr(this_ptr);
39087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39089         this_ptr_conv.is_owned = false;
39090         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
39091 }
39092
39093 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
39094         LDKUpdateFulfillHTLC this_ptr_conv;
39095         this_ptr_conv.inner = untag_ptr(this_ptr);
39096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39098         this_ptr_conv.is_owned = false;
39099         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39100         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
39101         return ret_arr;
39102 }
39103
39104 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
39105         LDKUpdateFulfillHTLC this_ptr_conv;
39106         this_ptr_conv.inner = untag_ptr(this_ptr);
39107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39109         this_ptr_conv.is_owned = false;
39110         LDKThirtyTwoBytes val_ref;
39111         CHECK(val->arr_len == 32);
39112         memcpy(val_ref.data, val->elems, 32); FREE(val);
39113         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
39114 }
39115
39116 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) {
39117         LDKThirtyTwoBytes channel_id_arg_ref;
39118         CHECK(channel_id_arg->arr_len == 32);
39119         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39120         LDKThirtyTwoBytes payment_preimage_arg_ref;
39121         CHECK(payment_preimage_arg->arr_len == 32);
39122         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
39123         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
39124         uint64_t ret_ref = 0;
39125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39127         return ret_ref;
39128 }
39129
39130 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
39131         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
39132         uint64_t ret_ref = 0;
39133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39135         return ret_ref;
39136 }
39137 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
39138         LDKUpdateFulfillHTLC arg_conv;
39139         arg_conv.inner = untag_ptr(arg);
39140         arg_conv.is_owned = ptr_is_owned(arg);
39141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39142         arg_conv.is_owned = false;
39143         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
39144         return ret_conv;
39145 }
39146
39147 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
39148         LDKUpdateFulfillHTLC orig_conv;
39149         orig_conv.inner = untag_ptr(orig);
39150         orig_conv.is_owned = ptr_is_owned(orig);
39151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39152         orig_conv.is_owned = false;
39153         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
39154         uint64_t ret_ref = 0;
39155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39157         return ret_ref;
39158 }
39159
39160 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
39161         LDKUpdateFulfillHTLC a_conv;
39162         a_conv.inner = untag_ptr(a);
39163         a_conv.is_owned = ptr_is_owned(a);
39164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39165         a_conv.is_owned = false;
39166         LDKUpdateFulfillHTLC b_conv;
39167         b_conv.inner = untag_ptr(b);
39168         b_conv.is_owned = ptr_is_owned(b);
39169         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39170         b_conv.is_owned = false;
39171         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
39172         return ret_conv;
39173 }
39174
39175 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
39176         LDKUpdateFailHTLC this_obj_conv;
39177         this_obj_conv.inner = untag_ptr(this_obj);
39178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39180         UpdateFailHTLC_free(this_obj_conv);
39181 }
39182
39183 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
39184         LDKUpdateFailHTLC this_ptr_conv;
39185         this_ptr_conv.inner = untag_ptr(this_ptr);
39186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39188         this_ptr_conv.is_owned = false;
39189         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39190         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
39191         return ret_arr;
39192 }
39193
39194 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39195         LDKUpdateFailHTLC this_ptr_conv;
39196         this_ptr_conv.inner = untag_ptr(this_ptr);
39197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39199         this_ptr_conv.is_owned = false;
39200         LDKThirtyTwoBytes val_ref;
39201         CHECK(val->arr_len == 32);
39202         memcpy(val_ref.data, val->elems, 32); FREE(val);
39203         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
39204 }
39205
39206 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
39207         LDKUpdateFailHTLC this_ptr_conv;
39208         this_ptr_conv.inner = untag_ptr(this_ptr);
39209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39211         this_ptr_conv.is_owned = false;
39212         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
39213         return ret_conv;
39214 }
39215
39216 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
39217         LDKUpdateFailHTLC this_ptr_conv;
39218         this_ptr_conv.inner = untag_ptr(this_ptr);
39219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39221         this_ptr_conv.is_owned = false;
39222         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
39223 }
39224
39225 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
39226         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
39227         uint64_t ret_ref = 0;
39228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39230         return ret_ref;
39231 }
39232 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
39233         LDKUpdateFailHTLC arg_conv;
39234         arg_conv.inner = untag_ptr(arg);
39235         arg_conv.is_owned = ptr_is_owned(arg);
39236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39237         arg_conv.is_owned = false;
39238         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
39239         return ret_conv;
39240 }
39241
39242 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
39243         LDKUpdateFailHTLC orig_conv;
39244         orig_conv.inner = untag_ptr(orig);
39245         orig_conv.is_owned = ptr_is_owned(orig);
39246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39247         orig_conv.is_owned = false;
39248         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
39249         uint64_t ret_ref = 0;
39250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39252         return ret_ref;
39253 }
39254
39255 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
39256         LDKUpdateFailHTLC a_conv;
39257         a_conv.inner = untag_ptr(a);
39258         a_conv.is_owned = ptr_is_owned(a);
39259         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39260         a_conv.is_owned = false;
39261         LDKUpdateFailHTLC b_conv;
39262         b_conv.inner = untag_ptr(b);
39263         b_conv.is_owned = ptr_is_owned(b);
39264         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39265         b_conv.is_owned = false;
39266         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
39267         return ret_conv;
39268 }
39269
39270 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
39271         LDKUpdateFailMalformedHTLC this_obj_conv;
39272         this_obj_conv.inner = untag_ptr(this_obj);
39273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39275         UpdateFailMalformedHTLC_free(this_obj_conv);
39276 }
39277
39278 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
39279         LDKUpdateFailMalformedHTLC this_ptr_conv;
39280         this_ptr_conv.inner = untag_ptr(this_ptr);
39281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39283         this_ptr_conv.is_owned = false;
39284         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39285         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
39286         return ret_arr;
39287 }
39288
39289 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39290         LDKUpdateFailMalformedHTLC this_ptr_conv;
39291         this_ptr_conv.inner = untag_ptr(this_ptr);
39292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39294         this_ptr_conv.is_owned = false;
39295         LDKThirtyTwoBytes val_ref;
39296         CHECK(val->arr_len == 32);
39297         memcpy(val_ref.data, val->elems, 32); FREE(val);
39298         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
39299 }
39300
39301 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
39302         LDKUpdateFailMalformedHTLC 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         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
39308         return ret_conv;
39309 }
39310
39311 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
39312         LDKUpdateFailMalformedHTLC this_ptr_conv;
39313         this_ptr_conv.inner = untag_ptr(this_ptr);
39314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39316         this_ptr_conv.is_owned = false;
39317         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
39318 }
39319
39320 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
39321         LDKUpdateFailMalformedHTLC this_ptr_conv;
39322         this_ptr_conv.inner = untag_ptr(this_ptr);
39323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39325         this_ptr_conv.is_owned = false;
39326         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
39327         return ret_conv;
39328 }
39329
39330 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
39331         LDKUpdateFailMalformedHTLC this_ptr_conv;
39332         this_ptr_conv.inner = untag_ptr(this_ptr);
39333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39335         this_ptr_conv.is_owned = false;
39336         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
39337 }
39338
39339 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
39340         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
39341         uint64_t ret_ref = 0;
39342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39344         return ret_ref;
39345 }
39346 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
39347         LDKUpdateFailMalformedHTLC arg_conv;
39348         arg_conv.inner = untag_ptr(arg);
39349         arg_conv.is_owned = ptr_is_owned(arg);
39350         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39351         arg_conv.is_owned = false;
39352         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
39353         return ret_conv;
39354 }
39355
39356 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
39357         LDKUpdateFailMalformedHTLC orig_conv;
39358         orig_conv.inner = untag_ptr(orig);
39359         orig_conv.is_owned = ptr_is_owned(orig);
39360         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39361         orig_conv.is_owned = false;
39362         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
39363         uint64_t ret_ref = 0;
39364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39366         return ret_ref;
39367 }
39368
39369 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
39370         LDKUpdateFailMalformedHTLC a_conv;
39371         a_conv.inner = untag_ptr(a);
39372         a_conv.is_owned = ptr_is_owned(a);
39373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39374         a_conv.is_owned = false;
39375         LDKUpdateFailMalformedHTLC b_conv;
39376         b_conv.inner = untag_ptr(b);
39377         b_conv.is_owned = ptr_is_owned(b);
39378         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39379         b_conv.is_owned = false;
39380         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
39381         return ret_conv;
39382 }
39383
39384 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
39385         LDKCommitmentSigned this_obj_conv;
39386         this_obj_conv.inner = untag_ptr(this_obj);
39387         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39389         CommitmentSigned_free(this_obj_conv);
39390 }
39391
39392 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
39393         LDKCommitmentSigned this_ptr_conv;
39394         this_ptr_conv.inner = untag_ptr(this_ptr);
39395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39397         this_ptr_conv.is_owned = false;
39398         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39399         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
39400         return ret_arr;
39401 }
39402
39403 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39404         LDKCommitmentSigned this_ptr_conv;
39405         this_ptr_conv.inner = untag_ptr(this_ptr);
39406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39408         this_ptr_conv.is_owned = false;
39409         LDKThirtyTwoBytes val_ref;
39410         CHECK(val->arr_len == 32);
39411         memcpy(val_ref.data, val->elems, 32); FREE(val);
39412         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
39413 }
39414
39415 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
39416         LDKCommitmentSigned this_ptr_conv;
39417         this_ptr_conv.inner = untag_ptr(this_ptr);
39418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39420         this_ptr_conv.is_owned = false;
39421         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39422         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
39423         return ret_arr;
39424 }
39425
39426 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
39427         LDKCommitmentSigned this_ptr_conv;
39428         this_ptr_conv.inner = untag_ptr(this_ptr);
39429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39431         this_ptr_conv.is_owned = false;
39432         LDKSignature val_ref;
39433         CHECK(val->arr_len == 64);
39434         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39435         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
39436 }
39437
39438 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
39439         LDKCommitmentSigned this_ptr_conv;
39440         this_ptr_conv.inner = untag_ptr(this_ptr);
39441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39443         this_ptr_conv.is_owned = false;
39444         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
39445         ptrArray ret_arr = NULL;
39446         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39447         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39448         for (size_t m = 0; m < ret_var.datalen; m++) {
39449                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
39450                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
39451                 ret_arr_ptr[m] = ret_conv_12_arr;
39452         }
39453         
39454         FREE(ret_var.data);
39455         return ret_arr;
39456 }
39457
39458 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
39459         LDKCommitmentSigned this_ptr_conv;
39460         this_ptr_conv.inner = untag_ptr(this_ptr);
39461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39463         this_ptr_conv.is_owned = false;
39464         LDKCVec_SignatureZ val_constr;
39465         val_constr.datalen = val->arr_len;
39466         if (val_constr.datalen > 0)
39467                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39468         else
39469                 val_constr.data = NULL;
39470         int8_tArray* val_vals = (void*) val->elems;
39471         for (size_t m = 0; m < val_constr.datalen; m++) {
39472                 int8_tArray val_conv_12 = val_vals[m];
39473                 LDKSignature val_conv_12_ref;
39474                 CHECK(val_conv_12->arr_len == 64);
39475                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
39476                 val_constr.data[m] = val_conv_12_ref;
39477         }
39478         FREE(val);
39479         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
39480 }
39481
39482 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
39483         LDKThirtyTwoBytes channel_id_arg_ref;
39484         CHECK(channel_id_arg->arr_len == 32);
39485         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39486         LDKSignature signature_arg_ref;
39487         CHECK(signature_arg->arr_len == 64);
39488         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
39489         LDKCVec_SignatureZ htlc_signatures_arg_constr;
39490         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
39491         if (htlc_signatures_arg_constr.datalen > 0)
39492                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39493         else
39494                 htlc_signatures_arg_constr.data = NULL;
39495         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
39496         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
39497                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
39498                 LDKSignature htlc_signatures_arg_conv_12_ref;
39499                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
39500                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
39501                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
39502         }
39503         FREE(htlc_signatures_arg);
39504         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
39505         uint64_t ret_ref = 0;
39506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39508         return ret_ref;
39509 }
39510
39511 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
39512         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
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 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
39519         LDKCommitmentSigned arg_conv;
39520         arg_conv.inner = untag_ptr(arg);
39521         arg_conv.is_owned = ptr_is_owned(arg);
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39523         arg_conv.is_owned = false;
39524         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
39525         return ret_conv;
39526 }
39527
39528 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
39529         LDKCommitmentSigned orig_conv;
39530         orig_conv.inner = untag_ptr(orig);
39531         orig_conv.is_owned = ptr_is_owned(orig);
39532         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39533         orig_conv.is_owned = false;
39534         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
39535         uint64_t ret_ref = 0;
39536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39538         return ret_ref;
39539 }
39540
39541 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
39542         LDKCommitmentSigned a_conv;
39543         a_conv.inner = untag_ptr(a);
39544         a_conv.is_owned = ptr_is_owned(a);
39545         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39546         a_conv.is_owned = false;
39547         LDKCommitmentSigned b_conv;
39548         b_conv.inner = untag_ptr(b);
39549         b_conv.is_owned = ptr_is_owned(b);
39550         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39551         b_conv.is_owned = false;
39552         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
39553         return ret_conv;
39554 }
39555
39556 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
39557         LDKRevokeAndACK this_obj_conv;
39558         this_obj_conv.inner = untag_ptr(this_obj);
39559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39561         RevokeAndACK_free(this_obj_conv);
39562 }
39563
39564 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
39565         LDKRevokeAndACK this_ptr_conv;
39566         this_ptr_conv.inner = untag_ptr(this_ptr);
39567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39569         this_ptr_conv.is_owned = false;
39570         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39571         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
39572         return ret_arr;
39573 }
39574
39575 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39576         LDKRevokeAndACK this_ptr_conv;
39577         this_ptr_conv.inner = untag_ptr(this_ptr);
39578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39580         this_ptr_conv.is_owned = false;
39581         LDKThirtyTwoBytes val_ref;
39582         CHECK(val->arr_len == 32);
39583         memcpy(val_ref.data, val->elems, 32); FREE(val);
39584         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
39585 }
39586
39587 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
39588         LDKRevokeAndACK this_ptr_conv;
39589         this_ptr_conv.inner = untag_ptr(this_ptr);
39590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39592         this_ptr_conv.is_owned = false;
39593         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39594         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
39595         return ret_arr;
39596 }
39597
39598 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
39599         LDKRevokeAndACK this_ptr_conv;
39600         this_ptr_conv.inner = untag_ptr(this_ptr);
39601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39603         this_ptr_conv.is_owned = false;
39604         LDKThirtyTwoBytes val_ref;
39605         CHECK(val->arr_len == 32);
39606         memcpy(val_ref.data, val->elems, 32); FREE(val);
39607         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
39608 }
39609
39610 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
39611         LDKRevokeAndACK this_ptr_conv;
39612         this_ptr_conv.inner = untag_ptr(this_ptr);
39613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39615         this_ptr_conv.is_owned = false;
39616         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39617         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39618         return ret_arr;
39619 }
39620
39621 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) {
39622         LDKRevokeAndACK this_ptr_conv;
39623         this_ptr_conv.inner = untag_ptr(this_ptr);
39624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39626         this_ptr_conv.is_owned = false;
39627         LDKPublicKey val_ref;
39628         CHECK(val->arr_len == 33);
39629         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39630         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
39631 }
39632
39633 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) {
39634         LDKThirtyTwoBytes channel_id_arg_ref;
39635         CHECK(channel_id_arg->arr_len == 32);
39636         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39637         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
39638         CHECK(per_commitment_secret_arg->arr_len == 32);
39639         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
39640         LDKPublicKey next_per_commitment_point_arg_ref;
39641         CHECK(next_per_commitment_point_arg->arr_len == 33);
39642         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
39643         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
39644         uint64_t ret_ref = 0;
39645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39647         return ret_ref;
39648 }
39649
39650 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
39651         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
39652         uint64_t ret_ref = 0;
39653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39655         return ret_ref;
39656 }
39657 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
39658         LDKRevokeAndACK arg_conv;
39659         arg_conv.inner = untag_ptr(arg);
39660         arg_conv.is_owned = ptr_is_owned(arg);
39661         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39662         arg_conv.is_owned = false;
39663         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
39664         return ret_conv;
39665 }
39666
39667 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
39668         LDKRevokeAndACK orig_conv;
39669         orig_conv.inner = untag_ptr(orig);
39670         orig_conv.is_owned = ptr_is_owned(orig);
39671         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39672         orig_conv.is_owned = false;
39673         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
39674         uint64_t ret_ref = 0;
39675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39677         return ret_ref;
39678 }
39679
39680 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
39681         LDKRevokeAndACK a_conv;
39682         a_conv.inner = untag_ptr(a);
39683         a_conv.is_owned = ptr_is_owned(a);
39684         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39685         a_conv.is_owned = false;
39686         LDKRevokeAndACK b_conv;
39687         b_conv.inner = untag_ptr(b);
39688         b_conv.is_owned = ptr_is_owned(b);
39689         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39690         b_conv.is_owned = false;
39691         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
39692         return ret_conv;
39693 }
39694
39695 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
39696         LDKUpdateFee this_obj_conv;
39697         this_obj_conv.inner = untag_ptr(this_obj);
39698         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39700         UpdateFee_free(this_obj_conv);
39701 }
39702
39703 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
39704         LDKUpdateFee this_ptr_conv;
39705         this_ptr_conv.inner = untag_ptr(this_ptr);
39706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39708         this_ptr_conv.is_owned = false;
39709         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39710         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
39711         return ret_arr;
39712 }
39713
39714 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39715         LDKUpdateFee this_ptr_conv;
39716         this_ptr_conv.inner = untag_ptr(this_ptr);
39717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39719         this_ptr_conv.is_owned = false;
39720         LDKThirtyTwoBytes val_ref;
39721         CHECK(val->arr_len == 32);
39722         memcpy(val_ref.data, val->elems, 32); FREE(val);
39723         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
39724 }
39725
39726 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
39727         LDKUpdateFee this_ptr_conv;
39728         this_ptr_conv.inner = untag_ptr(this_ptr);
39729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39731         this_ptr_conv.is_owned = false;
39732         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
39733         return ret_conv;
39734 }
39735
39736 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
39737         LDKUpdateFee this_ptr_conv;
39738         this_ptr_conv.inner = untag_ptr(this_ptr);
39739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39741         this_ptr_conv.is_owned = false;
39742         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
39743 }
39744
39745 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
39746         LDKThirtyTwoBytes channel_id_arg_ref;
39747         CHECK(channel_id_arg->arr_len == 32);
39748         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39749         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
39750         uint64_t ret_ref = 0;
39751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39753         return ret_ref;
39754 }
39755
39756 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
39757         LDKUpdateFee ret_var = UpdateFee_clone(arg);
39758         uint64_t ret_ref = 0;
39759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39761         return ret_ref;
39762 }
39763 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
39764         LDKUpdateFee arg_conv;
39765         arg_conv.inner = untag_ptr(arg);
39766         arg_conv.is_owned = ptr_is_owned(arg);
39767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39768         arg_conv.is_owned = false;
39769         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
39770         return ret_conv;
39771 }
39772
39773 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
39774         LDKUpdateFee orig_conv;
39775         orig_conv.inner = untag_ptr(orig);
39776         orig_conv.is_owned = ptr_is_owned(orig);
39777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39778         orig_conv.is_owned = false;
39779         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
39780         uint64_t ret_ref = 0;
39781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39783         return ret_ref;
39784 }
39785
39786 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
39787         LDKUpdateFee a_conv;
39788         a_conv.inner = untag_ptr(a);
39789         a_conv.is_owned = ptr_is_owned(a);
39790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39791         a_conv.is_owned = false;
39792         LDKUpdateFee b_conv;
39793         b_conv.inner = untag_ptr(b);
39794         b_conv.is_owned = ptr_is_owned(b);
39795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39796         b_conv.is_owned = false;
39797         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
39798         return ret_conv;
39799 }
39800
39801 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
39802         LDKChannelReestablish this_obj_conv;
39803         this_obj_conv.inner = untag_ptr(this_obj);
39804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39806         ChannelReestablish_free(this_obj_conv);
39807 }
39808
39809 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
39810         LDKChannelReestablish this_ptr_conv;
39811         this_ptr_conv.inner = untag_ptr(this_ptr);
39812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39814         this_ptr_conv.is_owned = false;
39815         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39816         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
39817         return ret_arr;
39818 }
39819
39820 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39821         LDKChannelReestablish this_ptr_conv;
39822         this_ptr_conv.inner = untag_ptr(this_ptr);
39823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39825         this_ptr_conv.is_owned = false;
39826         LDKThirtyTwoBytes val_ref;
39827         CHECK(val->arr_len == 32);
39828         memcpy(val_ref.data, val->elems, 32); FREE(val);
39829         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
39830 }
39831
39832 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
39833         LDKChannelReestablish this_ptr_conv;
39834         this_ptr_conv.inner = untag_ptr(this_ptr);
39835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39837         this_ptr_conv.is_owned = false;
39838         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
39839         return ret_conv;
39840 }
39841
39842 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) {
39843         LDKChannelReestablish this_ptr_conv;
39844         this_ptr_conv.inner = untag_ptr(this_ptr);
39845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39847         this_ptr_conv.is_owned = false;
39848         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
39849 }
39850
39851 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
39852         LDKChannelReestablish this_ptr_conv;
39853         this_ptr_conv.inner = untag_ptr(this_ptr);
39854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39856         this_ptr_conv.is_owned = false;
39857         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
39858         return ret_conv;
39859 }
39860
39861 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) {
39862         LDKChannelReestablish this_ptr_conv;
39863         this_ptr_conv.inner = untag_ptr(this_ptr);
39864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39866         this_ptr_conv.is_owned = false;
39867         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
39868 }
39869
39870 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) {
39871         LDKChannelReestablish this_ptr_conv;
39872         this_ptr_conv.inner = untag_ptr(this_ptr);
39873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39875         this_ptr_conv.is_owned = false;
39876         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39877         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
39878         return ret_arr;
39879 }
39880
39881 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) {
39882         LDKChannelReestablish this_ptr_conv;
39883         this_ptr_conv.inner = untag_ptr(this_ptr);
39884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39886         this_ptr_conv.is_owned = false;
39887         LDKThirtyTwoBytes val_ref;
39888         CHECK(val->arr_len == 32);
39889         memcpy(val_ref.data, val->elems, 32); FREE(val);
39890         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
39891 }
39892
39893 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) {
39894         LDKChannelReestablish this_ptr_conv;
39895         this_ptr_conv.inner = untag_ptr(this_ptr);
39896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39898         this_ptr_conv.is_owned = false;
39899         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39900         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39901         return ret_arr;
39902 }
39903
39904 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) {
39905         LDKChannelReestablish this_ptr_conv;
39906         this_ptr_conv.inner = untag_ptr(this_ptr);
39907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39909         this_ptr_conv.is_owned = false;
39910         LDKPublicKey val_ref;
39911         CHECK(val->arr_len == 33);
39912         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39913         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
39914 }
39915
39916 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
39917         LDKChannelReestablish this_ptr_conv;
39918         this_ptr_conv.inner = untag_ptr(this_ptr);
39919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39921         this_ptr_conv.is_owned = false;
39922         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
39923         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
39924         uint64_t ret_ref = tag_ptr(ret_copy, true);
39925         return ret_ref;
39926 }
39927
39928 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
39929         LDKChannelReestablish this_ptr_conv;
39930         this_ptr_conv.inner = untag_ptr(this_ptr);
39931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39933         this_ptr_conv.is_owned = false;
39934         void* val_ptr = untag_ptr(val);
39935         CHECK_ACCESS(val_ptr);
39936         LDKCOption_TxidZ val_conv = *(LDKCOption_TxidZ*)(val_ptr);
39937         val_conv = COption_TxidZ_clone((LDKCOption_TxidZ*)untag_ptr(val));
39938         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
39939 }
39940
39941 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) {
39942         LDKThirtyTwoBytes channel_id_arg_ref;
39943         CHECK(channel_id_arg->arr_len == 32);
39944         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39945         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
39946         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
39947         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
39948         LDKPublicKey my_current_per_commitment_point_arg_ref;
39949         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
39950         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);
39951         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
39952         CHECK_ACCESS(next_funding_txid_arg_ptr);
39953         LDKCOption_TxidZ next_funding_txid_arg_conv = *(LDKCOption_TxidZ*)(next_funding_txid_arg_ptr);
39954         next_funding_txid_arg_conv = COption_TxidZ_clone((LDKCOption_TxidZ*)untag_ptr(next_funding_txid_arg));
39955         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);
39956         uint64_t ret_ref = 0;
39957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39959         return ret_ref;
39960 }
39961
39962 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
39963         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
39964         uint64_t ret_ref = 0;
39965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39967         return ret_ref;
39968 }
39969 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
39970         LDKChannelReestablish arg_conv;
39971         arg_conv.inner = untag_ptr(arg);
39972         arg_conv.is_owned = ptr_is_owned(arg);
39973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39974         arg_conv.is_owned = false;
39975         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
39976         return ret_conv;
39977 }
39978
39979 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
39980         LDKChannelReestablish orig_conv;
39981         orig_conv.inner = untag_ptr(orig);
39982         orig_conv.is_owned = ptr_is_owned(orig);
39983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39984         orig_conv.is_owned = false;
39985         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
39986         uint64_t ret_ref = 0;
39987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39989         return ret_ref;
39990 }
39991
39992 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
39993         LDKChannelReestablish a_conv;
39994         a_conv.inner = untag_ptr(a);
39995         a_conv.is_owned = ptr_is_owned(a);
39996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39997         a_conv.is_owned = false;
39998         LDKChannelReestablish b_conv;
39999         b_conv.inner = untag_ptr(b);
40000         b_conv.is_owned = ptr_is_owned(b);
40001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40002         b_conv.is_owned = false;
40003         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
40004         return ret_conv;
40005 }
40006
40007 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
40008         LDKAnnouncementSignatures this_obj_conv;
40009         this_obj_conv.inner = untag_ptr(this_obj);
40010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40012         AnnouncementSignatures_free(this_obj_conv);
40013 }
40014
40015 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
40016         LDKAnnouncementSignatures this_ptr_conv;
40017         this_ptr_conv.inner = untag_ptr(this_ptr);
40018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40020         this_ptr_conv.is_owned = false;
40021         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40022         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
40023         return ret_arr;
40024 }
40025
40026 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40027         LDKAnnouncementSignatures this_ptr_conv;
40028         this_ptr_conv.inner = untag_ptr(this_ptr);
40029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40031         this_ptr_conv.is_owned = false;
40032         LDKThirtyTwoBytes val_ref;
40033         CHECK(val->arr_len == 32);
40034         memcpy(val_ref.data, val->elems, 32); FREE(val);
40035         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
40036 }
40037
40038 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
40039         LDKAnnouncementSignatures this_ptr_conv;
40040         this_ptr_conv.inner = untag_ptr(this_ptr);
40041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40043         this_ptr_conv.is_owned = false;
40044         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
40045         return ret_conv;
40046 }
40047
40048 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
40049         LDKAnnouncementSignatures this_ptr_conv;
40050         this_ptr_conv.inner = untag_ptr(this_ptr);
40051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40053         this_ptr_conv.is_owned = false;
40054         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
40055 }
40056
40057 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
40058         LDKAnnouncementSignatures this_ptr_conv;
40059         this_ptr_conv.inner = untag_ptr(this_ptr);
40060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40062         this_ptr_conv.is_owned = false;
40063         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40064         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
40065         return ret_arr;
40066 }
40067
40068 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
40069         LDKAnnouncementSignatures this_ptr_conv;
40070         this_ptr_conv.inner = untag_ptr(this_ptr);
40071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40073         this_ptr_conv.is_owned = false;
40074         LDKSignature val_ref;
40075         CHECK(val->arr_len == 64);
40076         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40077         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
40078 }
40079
40080 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
40081         LDKAnnouncementSignatures this_ptr_conv;
40082         this_ptr_conv.inner = untag_ptr(this_ptr);
40083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40085         this_ptr_conv.is_owned = false;
40086         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40087         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
40088         return ret_arr;
40089 }
40090
40091 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
40092         LDKAnnouncementSignatures this_ptr_conv;
40093         this_ptr_conv.inner = untag_ptr(this_ptr);
40094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40096         this_ptr_conv.is_owned = false;
40097         LDKSignature val_ref;
40098         CHECK(val->arr_len == 64);
40099         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40100         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
40101 }
40102
40103 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) {
40104         LDKThirtyTwoBytes channel_id_arg_ref;
40105         CHECK(channel_id_arg->arr_len == 32);
40106         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40107         LDKSignature node_signature_arg_ref;
40108         CHECK(node_signature_arg->arr_len == 64);
40109         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
40110         LDKSignature bitcoin_signature_arg_ref;
40111         CHECK(bitcoin_signature_arg->arr_len == 64);
40112         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
40113         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
40114         uint64_t ret_ref = 0;
40115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40117         return ret_ref;
40118 }
40119
40120 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
40121         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
40122         uint64_t ret_ref = 0;
40123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40125         return ret_ref;
40126 }
40127 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
40128         LDKAnnouncementSignatures arg_conv;
40129         arg_conv.inner = untag_ptr(arg);
40130         arg_conv.is_owned = ptr_is_owned(arg);
40131         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40132         arg_conv.is_owned = false;
40133         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
40134         return ret_conv;
40135 }
40136
40137 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
40138         LDKAnnouncementSignatures orig_conv;
40139         orig_conv.inner = untag_ptr(orig);
40140         orig_conv.is_owned = ptr_is_owned(orig);
40141         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40142         orig_conv.is_owned = false;
40143         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
40144         uint64_t ret_ref = 0;
40145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40147         return ret_ref;
40148 }
40149
40150 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
40151         LDKAnnouncementSignatures a_conv;
40152         a_conv.inner = untag_ptr(a);
40153         a_conv.is_owned = ptr_is_owned(a);
40154         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40155         a_conv.is_owned = false;
40156         LDKAnnouncementSignatures b_conv;
40157         b_conv.inner = untag_ptr(b);
40158         b_conv.is_owned = ptr_is_owned(b);
40159         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40160         b_conv.is_owned = false;
40161         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
40162         return ret_conv;
40163 }
40164
40165 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
40166         if (!ptr_is_owned(this_ptr)) return;
40167         void* this_ptr_ptr = untag_ptr(this_ptr);
40168         CHECK_ACCESS(this_ptr_ptr);
40169         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
40170         FREE(untag_ptr(this_ptr));
40171         NetAddress_free(this_ptr_conv);
40172 }
40173
40174 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
40175         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40176         *ret_copy = NetAddress_clone(arg);
40177         uint64_t ret_ref = tag_ptr(ret_copy, true);
40178         return ret_ref;
40179 }
40180 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
40181         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
40182         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
40183         return ret_conv;
40184 }
40185
40186 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
40187         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
40188         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40189         *ret_copy = NetAddress_clone(orig_conv);
40190         uint64_t ret_ref = tag_ptr(ret_copy, true);
40191         return ret_ref;
40192 }
40193
40194 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
40195         LDKFourBytes addr_ref;
40196         CHECK(addr->arr_len == 4);
40197         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
40198         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40199         *ret_copy = NetAddress_ipv4(addr_ref, port);
40200         uint64_t ret_ref = tag_ptr(ret_copy, true);
40201         return ret_ref;
40202 }
40203
40204 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
40205         LDKSixteenBytes addr_ref;
40206         CHECK(addr->arr_len == 16);
40207         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
40208         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40209         *ret_copy = NetAddress_ipv6(addr_ref, port);
40210         uint64_t ret_ref = tag_ptr(ret_copy, true);
40211         return ret_ref;
40212 }
40213
40214 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
40215         LDKTwelveBytes a_ref;
40216         CHECK(a->arr_len == 12);
40217         memcpy(a_ref.data, a->elems, 12); FREE(a);
40218         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40219         *ret_copy = NetAddress_onion_v2(a_ref);
40220         uint64_t ret_ref = tag_ptr(ret_copy, true);
40221         return ret_ref;
40222 }
40223
40224 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v3"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
40225         LDKThirtyTwoBytes ed25519_pubkey_ref;
40226         CHECK(ed25519_pubkey->arr_len == 32);
40227         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
40228         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40229         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
40230         uint64_t ret_ref = tag_ptr(ret_copy, true);
40231         return ret_ref;
40232 }
40233
40234 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
40235         LDKHostname hostname_conv;
40236         hostname_conv.inner = untag_ptr(hostname);
40237         hostname_conv.is_owned = ptr_is_owned(hostname);
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
40239         hostname_conv = Hostname_clone(&hostname_conv);
40240         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40241         *ret_copy = NetAddress_hostname(hostname_conv, port);
40242         uint64_t ret_ref = tag_ptr(ret_copy, true);
40243         return ret_ref;
40244 }
40245
40246 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
40247         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
40248         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
40249         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
40250         return ret_conv;
40251 }
40252
40253 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
40254         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
40255         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
40256         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40257         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40258         CVec_u8Z_free(ret_var);
40259         return ret_arr;
40260 }
40261
40262 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
40263         LDKu8slice ser_ref;
40264         ser_ref.datalen = ser->arr_len;
40265         ser_ref.data = ser->elems;
40266         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
40267         *ret_conv = NetAddress_read(ser_ref);
40268         FREE(ser);
40269         return tag_ptr(ret_conv, true);
40270 }
40271
40272 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
40273         if (!ptr_is_owned(this_ptr)) return;
40274         void* this_ptr_ptr = untag_ptr(this_ptr);
40275         CHECK_ACCESS(this_ptr_ptr);
40276         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
40277         FREE(untag_ptr(this_ptr));
40278         UnsignedGossipMessage_free(this_ptr_conv);
40279 }
40280
40281 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
40282         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40283         *ret_copy = UnsignedGossipMessage_clone(arg);
40284         uint64_t ret_ref = tag_ptr(ret_copy, true);
40285         return ret_ref;
40286 }
40287 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
40288         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
40289         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
40290         return ret_conv;
40291 }
40292
40293 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
40294         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
40295         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40296         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
40297         uint64_t ret_ref = tag_ptr(ret_copy, true);
40298         return ret_ref;
40299 }
40300
40301 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
40302         LDKUnsignedChannelAnnouncement a_conv;
40303         a_conv.inner = untag_ptr(a);
40304         a_conv.is_owned = ptr_is_owned(a);
40305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40306         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
40307         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40308         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
40309         uint64_t ret_ref = tag_ptr(ret_copy, true);
40310         return ret_ref;
40311 }
40312
40313 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
40314         LDKUnsignedChannelUpdate a_conv;
40315         a_conv.inner = untag_ptr(a);
40316         a_conv.is_owned = ptr_is_owned(a);
40317         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40318         a_conv = UnsignedChannelUpdate_clone(&a_conv);
40319         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40320         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
40321         uint64_t ret_ref = tag_ptr(ret_copy, true);
40322         return ret_ref;
40323 }
40324
40325 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
40326         LDKUnsignedNodeAnnouncement a_conv;
40327         a_conv.inner = untag_ptr(a);
40328         a_conv.is_owned = ptr_is_owned(a);
40329         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40330         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
40331         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40332         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
40333         uint64_t ret_ref = tag_ptr(ret_copy, true);
40334         return ret_ref;
40335 }
40336
40337 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
40338         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
40339         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
40340         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40341         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40342         CVec_u8Z_free(ret_var);
40343         return ret_arr;
40344 }
40345
40346 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
40347         LDKUnsignedNodeAnnouncement this_obj_conv;
40348         this_obj_conv.inner = untag_ptr(this_obj);
40349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40351         UnsignedNodeAnnouncement_free(this_obj_conv);
40352 }
40353
40354 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
40355         LDKUnsignedNodeAnnouncement this_ptr_conv;
40356         this_ptr_conv.inner = untag_ptr(this_ptr);
40357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40359         this_ptr_conv.is_owned = false;
40360         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
40361         uint64_t ret_ref = 0;
40362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40364         return ret_ref;
40365 }
40366
40367 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
40368         LDKUnsignedNodeAnnouncement this_ptr_conv;
40369         this_ptr_conv.inner = untag_ptr(this_ptr);
40370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40372         this_ptr_conv.is_owned = false;
40373         LDKNodeFeatures val_conv;
40374         val_conv.inner = untag_ptr(val);
40375         val_conv.is_owned = ptr_is_owned(val);
40376         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40377         val_conv = NodeFeatures_clone(&val_conv);
40378         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
40379 }
40380
40381 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
40382         LDKUnsignedNodeAnnouncement this_ptr_conv;
40383         this_ptr_conv.inner = untag_ptr(this_ptr);
40384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40386         this_ptr_conv.is_owned = false;
40387         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
40388         return ret_conv;
40389 }
40390
40391 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
40392         LDKUnsignedNodeAnnouncement this_ptr_conv;
40393         this_ptr_conv.inner = untag_ptr(this_ptr);
40394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40396         this_ptr_conv.is_owned = false;
40397         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
40398 }
40399
40400 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
40401         LDKUnsignedNodeAnnouncement this_ptr_conv;
40402         this_ptr_conv.inner = untag_ptr(this_ptr);
40403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40405         this_ptr_conv.is_owned = false;
40406         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_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 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
40414         LDKUnsignedNodeAnnouncement this_ptr_conv;
40415         this_ptr_conv.inner = untag_ptr(this_ptr);
40416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40418         this_ptr_conv.is_owned = false;
40419         LDKNodeId val_conv;
40420         val_conv.inner = untag_ptr(val);
40421         val_conv.is_owned = ptr_is_owned(val);
40422         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40423         val_conv = NodeId_clone(&val_conv);
40424         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
40425 }
40426
40427 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
40428         LDKUnsignedNodeAnnouncement this_ptr_conv;
40429         this_ptr_conv.inner = untag_ptr(this_ptr);
40430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40432         this_ptr_conv.is_owned = false;
40433         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
40434         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
40435         return ret_arr;
40436 }
40437
40438 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
40439         LDKUnsignedNodeAnnouncement this_ptr_conv;
40440         this_ptr_conv.inner = untag_ptr(this_ptr);
40441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40443         this_ptr_conv.is_owned = false;
40444         LDKThreeBytes val_ref;
40445         CHECK(val->arr_len == 3);
40446         memcpy(val_ref.data, val->elems, 3); FREE(val);
40447         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
40448 }
40449
40450 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
40451         LDKUnsignedNodeAnnouncement this_ptr_conv;
40452         this_ptr_conv.inner = untag_ptr(this_ptr);
40453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40455         this_ptr_conv.is_owned = false;
40456         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
40457         uint64_t ret_ref = 0;
40458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40460         return ret_ref;
40461 }
40462
40463 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
40464         LDKUnsignedNodeAnnouncement this_ptr_conv;
40465         this_ptr_conv.inner = untag_ptr(this_ptr);
40466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40468         this_ptr_conv.is_owned = false;
40469         LDKNodeAlias val_conv;
40470         val_conv.inner = untag_ptr(val);
40471         val_conv.is_owned = ptr_is_owned(val);
40472         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40473         val_conv = NodeAlias_clone(&val_conv);
40474         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
40475 }
40476
40477 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
40478         LDKUnsignedNodeAnnouncement this_ptr_conv;
40479         this_ptr_conv.inner = untag_ptr(this_ptr);
40480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40482         this_ptr_conv.is_owned = false;
40483         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
40484         uint64_tArray ret_arr = NULL;
40485         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40486         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40487         for (size_t m = 0; m < ret_var.datalen; m++) {
40488                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40489                 *ret_conv_12_copy = ret_var.data[m];
40490                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
40491                 ret_arr_ptr[m] = ret_conv_12_ref;
40492         }
40493         
40494         FREE(ret_var.data);
40495         return ret_arr;
40496 }
40497
40498 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
40499         LDKUnsignedNodeAnnouncement this_ptr_conv;
40500         this_ptr_conv.inner = untag_ptr(this_ptr);
40501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40503         this_ptr_conv.is_owned = false;
40504         LDKCVec_NetAddressZ val_constr;
40505         val_constr.datalen = val->arr_len;
40506         if (val_constr.datalen > 0)
40507                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40508         else
40509                 val_constr.data = NULL;
40510         uint64_t* val_vals = val->elems;
40511         for (size_t m = 0; m < val_constr.datalen; m++) {
40512                 uint64_t val_conv_12 = val_vals[m];
40513                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
40514                 CHECK_ACCESS(val_conv_12_ptr);
40515                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40516                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
40517                 val_constr.data[m] = val_conv_12_conv;
40518         }
40519         FREE(val);
40520         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
40521 }
40522
40523 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
40524         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
40525         uint64_t ret_ref = 0;
40526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40528         return ret_ref;
40529 }
40530 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
40531         LDKUnsignedNodeAnnouncement arg_conv;
40532         arg_conv.inner = untag_ptr(arg);
40533         arg_conv.is_owned = ptr_is_owned(arg);
40534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40535         arg_conv.is_owned = false;
40536         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
40537         return ret_conv;
40538 }
40539
40540 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
40541         LDKUnsignedNodeAnnouncement orig_conv;
40542         orig_conv.inner = untag_ptr(orig);
40543         orig_conv.is_owned = ptr_is_owned(orig);
40544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40545         orig_conv.is_owned = false;
40546         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
40547         uint64_t ret_ref = 0;
40548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40550         return ret_ref;
40551 }
40552
40553 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
40554         LDKUnsignedNodeAnnouncement a_conv;
40555         a_conv.inner = untag_ptr(a);
40556         a_conv.is_owned = ptr_is_owned(a);
40557         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40558         a_conv.is_owned = false;
40559         LDKUnsignedNodeAnnouncement b_conv;
40560         b_conv.inner = untag_ptr(b);
40561         b_conv.is_owned = ptr_is_owned(b);
40562         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40563         b_conv.is_owned = false;
40564         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
40565         return ret_conv;
40566 }
40567
40568 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
40569         LDKNodeAnnouncement this_obj_conv;
40570         this_obj_conv.inner = untag_ptr(this_obj);
40571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40573         NodeAnnouncement_free(this_obj_conv);
40574 }
40575
40576 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
40577         LDKNodeAnnouncement this_ptr_conv;
40578         this_ptr_conv.inner = untag_ptr(this_ptr);
40579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40581         this_ptr_conv.is_owned = false;
40582         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40583         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
40584         return ret_arr;
40585 }
40586
40587 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
40588         LDKNodeAnnouncement this_ptr_conv;
40589         this_ptr_conv.inner = untag_ptr(this_ptr);
40590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40592         this_ptr_conv.is_owned = false;
40593         LDKSignature val_ref;
40594         CHECK(val->arr_len == 64);
40595         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40596         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
40597 }
40598
40599 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
40600         LDKNodeAnnouncement this_ptr_conv;
40601         this_ptr_conv.inner = untag_ptr(this_ptr);
40602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40604         this_ptr_conv.is_owned = false;
40605         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
40606         uint64_t ret_ref = 0;
40607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40609         return ret_ref;
40610 }
40611
40612 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
40613         LDKNodeAnnouncement this_ptr_conv;
40614         this_ptr_conv.inner = untag_ptr(this_ptr);
40615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40617         this_ptr_conv.is_owned = false;
40618         LDKUnsignedNodeAnnouncement val_conv;
40619         val_conv.inner = untag_ptr(val);
40620         val_conv.is_owned = ptr_is_owned(val);
40621         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40622         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
40623         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
40624 }
40625
40626 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
40627         LDKSignature signature_arg_ref;
40628         CHECK(signature_arg->arr_len == 64);
40629         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
40630         LDKUnsignedNodeAnnouncement contents_arg_conv;
40631         contents_arg_conv.inner = untag_ptr(contents_arg);
40632         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
40633         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
40634         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
40635         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
40636         uint64_t ret_ref = 0;
40637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40639         return ret_ref;
40640 }
40641
40642 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
40643         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
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 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
40650         LDKNodeAnnouncement arg_conv;
40651         arg_conv.inner = untag_ptr(arg);
40652         arg_conv.is_owned = ptr_is_owned(arg);
40653         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40654         arg_conv.is_owned = false;
40655         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
40656         return ret_conv;
40657 }
40658
40659 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
40660         LDKNodeAnnouncement orig_conv;
40661         orig_conv.inner = untag_ptr(orig);
40662         orig_conv.is_owned = ptr_is_owned(orig);
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40664         orig_conv.is_owned = false;
40665         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
40666         uint64_t ret_ref = 0;
40667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40669         return ret_ref;
40670 }
40671
40672 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
40673         LDKNodeAnnouncement a_conv;
40674         a_conv.inner = untag_ptr(a);
40675         a_conv.is_owned = ptr_is_owned(a);
40676         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40677         a_conv.is_owned = false;
40678         LDKNodeAnnouncement b_conv;
40679         b_conv.inner = untag_ptr(b);
40680         b_conv.is_owned = ptr_is_owned(b);
40681         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40682         b_conv.is_owned = false;
40683         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
40684         return ret_conv;
40685 }
40686
40687 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
40688         LDKUnsignedChannelAnnouncement this_obj_conv;
40689         this_obj_conv.inner = untag_ptr(this_obj);
40690         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40692         UnsignedChannelAnnouncement_free(this_obj_conv);
40693 }
40694
40695 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
40696         LDKUnsignedChannelAnnouncement this_ptr_conv;
40697         this_ptr_conv.inner = untag_ptr(this_ptr);
40698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40700         this_ptr_conv.is_owned = false;
40701         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
40702         uint64_t ret_ref = 0;
40703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40705         return ret_ref;
40706 }
40707
40708 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
40709         LDKUnsignedChannelAnnouncement this_ptr_conv;
40710         this_ptr_conv.inner = untag_ptr(this_ptr);
40711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40713         this_ptr_conv.is_owned = false;
40714         LDKChannelFeatures val_conv;
40715         val_conv.inner = untag_ptr(val);
40716         val_conv.is_owned = ptr_is_owned(val);
40717         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40718         val_conv = ChannelFeatures_clone(&val_conv);
40719         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
40720 }
40721
40722 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
40723         LDKUnsignedChannelAnnouncement this_ptr_conv;
40724         this_ptr_conv.inner = untag_ptr(this_ptr);
40725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40727         this_ptr_conv.is_owned = false;
40728         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40729         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
40730         return ret_arr;
40731 }
40732
40733 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
40734         LDKUnsignedChannelAnnouncement this_ptr_conv;
40735         this_ptr_conv.inner = untag_ptr(this_ptr);
40736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40738         this_ptr_conv.is_owned = false;
40739         LDKThirtyTwoBytes val_ref;
40740         CHECK(val->arr_len == 32);
40741         memcpy(val_ref.data, val->elems, 32); FREE(val);
40742         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
40743 }
40744
40745 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
40746         LDKUnsignedChannelAnnouncement this_ptr_conv;
40747         this_ptr_conv.inner = untag_ptr(this_ptr);
40748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40750         this_ptr_conv.is_owned = false;
40751         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
40752         return ret_conv;
40753 }
40754
40755 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
40756         LDKUnsignedChannelAnnouncement this_ptr_conv;
40757         this_ptr_conv.inner = untag_ptr(this_ptr);
40758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40760         this_ptr_conv.is_owned = false;
40761         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
40762 }
40763
40764 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
40765         LDKUnsignedChannelAnnouncement this_ptr_conv;
40766         this_ptr_conv.inner = untag_ptr(this_ptr);
40767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40769         this_ptr_conv.is_owned = false;
40770         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
40771         uint64_t ret_ref = 0;
40772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40774         return ret_ref;
40775 }
40776
40777 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
40778         LDKUnsignedChannelAnnouncement this_ptr_conv;
40779         this_ptr_conv.inner = untag_ptr(this_ptr);
40780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40782         this_ptr_conv.is_owned = false;
40783         LDKNodeId val_conv;
40784         val_conv.inner = untag_ptr(val);
40785         val_conv.is_owned = ptr_is_owned(val);
40786         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40787         val_conv = NodeId_clone(&val_conv);
40788         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
40789 }
40790
40791 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
40792         LDKUnsignedChannelAnnouncement this_ptr_conv;
40793         this_ptr_conv.inner = untag_ptr(this_ptr);
40794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40796         this_ptr_conv.is_owned = false;
40797         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
40798         uint64_t ret_ref = 0;
40799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40801         return ret_ref;
40802 }
40803
40804 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
40805         LDKUnsignedChannelAnnouncement this_ptr_conv;
40806         this_ptr_conv.inner = untag_ptr(this_ptr);
40807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40809         this_ptr_conv.is_owned = false;
40810         LDKNodeId val_conv;
40811         val_conv.inner = untag_ptr(val);
40812         val_conv.is_owned = ptr_is_owned(val);
40813         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40814         val_conv = NodeId_clone(&val_conv);
40815         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
40816 }
40817
40818 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
40819         LDKUnsignedChannelAnnouncement this_ptr_conv;
40820         this_ptr_conv.inner = untag_ptr(this_ptr);
40821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40823         this_ptr_conv.is_owned = false;
40824         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
40825         uint64_t ret_ref = 0;
40826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40828         return ret_ref;
40829 }
40830
40831 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
40832         LDKUnsignedChannelAnnouncement this_ptr_conv;
40833         this_ptr_conv.inner = untag_ptr(this_ptr);
40834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40836         this_ptr_conv.is_owned = false;
40837         LDKNodeId val_conv;
40838         val_conv.inner = untag_ptr(val);
40839         val_conv.is_owned = ptr_is_owned(val);
40840         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40841         val_conv = NodeId_clone(&val_conv);
40842         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
40843 }
40844
40845 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
40846         LDKUnsignedChannelAnnouncement this_ptr_conv;
40847         this_ptr_conv.inner = untag_ptr(this_ptr);
40848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40850         this_ptr_conv.is_owned = false;
40851         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
40852         uint64_t ret_ref = 0;
40853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40855         return ret_ref;
40856 }
40857
40858 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
40859         LDKUnsignedChannelAnnouncement this_ptr_conv;
40860         this_ptr_conv.inner = untag_ptr(this_ptr);
40861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40863         this_ptr_conv.is_owned = false;
40864         LDKNodeId val_conv;
40865         val_conv.inner = untag_ptr(val);
40866         val_conv.is_owned = ptr_is_owned(val);
40867         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40868         val_conv = NodeId_clone(&val_conv);
40869         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
40870 }
40871
40872 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
40873         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
40874         uint64_t ret_ref = 0;
40875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40877         return ret_ref;
40878 }
40879 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
40880         LDKUnsignedChannelAnnouncement arg_conv;
40881         arg_conv.inner = untag_ptr(arg);
40882         arg_conv.is_owned = ptr_is_owned(arg);
40883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40884         arg_conv.is_owned = false;
40885         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
40886         return ret_conv;
40887 }
40888
40889 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
40890         LDKUnsignedChannelAnnouncement orig_conv;
40891         orig_conv.inner = untag_ptr(orig);
40892         orig_conv.is_owned = ptr_is_owned(orig);
40893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40894         orig_conv.is_owned = false;
40895         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
40896         uint64_t ret_ref = 0;
40897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40899         return ret_ref;
40900 }
40901
40902 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
40903         LDKUnsignedChannelAnnouncement a_conv;
40904         a_conv.inner = untag_ptr(a);
40905         a_conv.is_owned = ptr_is_owned(a);
40906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40907         a_conv.is_owned = false;
40908         LDKUnsignedChannelAnnouncement b_conv;
40909         b_conv.inner = untag_ptr(b);
40910         b_conv.is_owned = ptr_is_owned(b);
40911         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40912         b_conv.is_owned = false;
40913         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
40914         return ret_conv;
40915 }
40916
40917 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
40918         LDKChannelAnnouncement this_obj_conv;
40919         this_obj_conv.inner = untag_ptr(this_obj);
40920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40922         ChannelAnnouncement_free(this_obj_conv);
40923 }
40924
40925 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
40926         LDKChannelAnnouncement this_ptr_conv;
40927         this_ptr_conv.inner = untag_ptr(this_ptr);
40928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40930         this_ptr_conv.is_owned = false;
40931         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40932         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
40933         return ret_arr;
40934 }
40935
40936 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
40937         LDKChannelAnnouncement this_ptr_conv;
40938         this_ptr_conv.inner = untag_ptr(this_ptr);
40939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40941         this_ptr_conv.is_owned = false;
40942         LDKSignature val_ref;
40943         CHECK(val->arr_len == 64);
40944         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40945         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
40946 }
40947
40948 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
40949         LDKChannelAnnouncement this_ptr_conv;
40950         this_ptr_conv.inner = untag_ptr(this_ptr);
40951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40953         this_ptr_conv.is_owned = false;
40954         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40955         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
40956         return ret_arr;
40957 }
40958
40959 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
40960         LDKChannelAnnouncement this_ptr_conv;
40961         this_ptr_conv.inner = untag_ptr(this_ptr);
40962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40964         this_ptr_conv.is_owned = false;
40965         LDKSignature val_ref;
40966         CHECK(val->arr_len == 64);
40967         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40968         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
40969 }
40970
40971 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
40972         LDKChannelAnnouncement this_ptr_conv;
40973         this_ptr_conv.inner = untag_ptr(this_ptr);
40974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40976         this_ptr_conv.is_owned = false;
40977         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40978         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
40979         return ret_arr;
40980 }
40981
40982 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
40983         LDKChannelAnnouncement this_ptr_conv;
40984         this_ptr_conv.inner = untag_ptr(this_ptr);
40985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40987         this_ptr_conv.is_owned = false;
40988         LDKSignature val_ref;
40989         CHECK(val->arr_len == 64);
40990         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40991         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
40992 }
40993
40994 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
40995         LDKChannelAnnouncement this_ptr_conv;
40996         this_ptr_conv.inner = untag_ptr(this_ptr);
40997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40999         this_ptr_conv.is_owned = false;
41000         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
41001         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
41002         return ret_arr;
41003 }
41004
41005 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
41006         LDKChannelAnnouncement this_ptr_conv;
41007         this_ptr_conv.inner = untag_ptr(this_ptr);
41008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41010         this_ptr_conv.is_owned = false;
41011         LDKSignature val_ref;
41012         CHECK(val->arr_len == 64);
41013         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
41014         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
41015 }
41016
41017 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
41018         LDKChannelAnnouncement this_ptr_conv;
41019         this_ptr_conv.inner = untag_ptr(this_ptr);
41020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41022         this_ptr_conv.is_owned = false;
41023         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
41024         uint64_t ret_ref = 0;
41025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41027         return ret_ref;
41028 }
41029
41030 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
41031         LDKChannelAnnouncement this_ptr_conv;
41032         this_ptr_conv.inner = untag_ptr(this_ptr);
41033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41035         this_ptr_conv.is_owned = false;
41036         LDKUnsignedChannelAnnouncement val_conv;
41037         val_conv.inner = untag_ptr(val);
41038         val_conv.is_owned = ptr_is_owned(val);
41039         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41040         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
41041         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
41042 }
41043
41044 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) {
41045         LDKSignature node_signature_1_arg_ref;
41046         CHECK(node_signature_1_arg->arr_len == 64);
41047         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
41048         LDKSignature node_signature_2_arg_ref;
41049         CHECK(node_signature_2_arg->arr_len == 64);
41050         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
41051         LDKSignature bitcoin_signature_1_arg_ref;
41052         CHECK(bitcoin_signature_1_arg->arr_len == 64);
41053         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
41054         LDKSignature bitcoin_signature_2_arg_ref;
41055         CHECK(bitcoin_signature_2_arg->arr_len == 64);
41056         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
41057         LDKUnsignedChannelAnnouncement contents_arg_conv;
41058         contents_arg_conv.inner = untag_ptr(contents_arg);
41059         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
41060         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
41061         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
41062         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);
41063         uint64_t ret_ref = 0;
41064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41066         return ret_ref;
41067 }
41068
41069 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
41070         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
41071         uint64_t ret_ref = 0;
41072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41074         return ret_ref;
41075 }
41076 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
41077         LDKChannelAnnouncement arg_conv;
41078         arg_conv.inner = untag_ptr(arg);
41079         arg_conv.is_owned = ptr_is_owned(arg);
41080         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41081         arg_conv.is_owned = false;
41082         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
41083         return ret_conv;
41084 }
41085
41086 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
41087         LDKChannelAnnouncement orig_conv;
41088         orig_conv.inner = untag_ptr(orig);
41089         orig_conv.is_owned = ptr_is_owned(orig);
41090         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41091         orig_conv.is_owned = false;
41092         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
41093         uint64_t ret_ref = 0;
41094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41096         return ret_ref;
41097 }
41098
41099 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
41100         LDKChannelAnnouncement a_conv;
41101         a_conv.inner = untag_ptr(a);
41102         a_conv.is_owned = ptr_is_owned(a);
41103         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41104         a_conv.is_owned = false;
41105         LDKChannelAnnouncement b_conv;
41106         b_conv.inner = untag_ptr(b);
41107         b_conv.is_owned = ptr_is_owned(b);
41108         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41109         b_conv.is_owned = false;
41110         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
41111         return ret_conv;
41112 }
41113
41114 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
41115         LDKUnsignedChannelUpdate this_obj_conv;
41116         this_obj_conv.inner = untag_ptr(this_obj);
41117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41119         UnsignedChannelUpdate_free(this_obj_conv);
41120 }
41121
41122 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
41123         LDKUnsignedChannelUpdate this_ptr_conv;
41124         this_ptr_conv.inner = untag_ptr(this_ptr);
41125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41127         this_ptr_conv.is_owned = false;
41128         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41129         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
41130         return ret_arr;
41131 }
41132
41133 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41134         LDKUnsignedChannelUpdate this_ptr_conv;
41135         this_ptr_conv.inner = untag_ptr(this_ptr);
41136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41138         this_ptr_conv.is_owned = false;
41139         LDKThirtyTwoBytes val_ref;
41140         CHECK(val->arr_len == 32);
41141         memcpy(val_ref.data, val->elems, 32); FREE(val);
41142         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
41143 }
41144
41145 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
41146         LDKUnsignedChannelUpdate this_ptr_conv;
41147         this_ptr_conv.inner = untag_ptr(this_ptr);
41148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41150         this_ptr_conv.is_owned = false;
41151         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
41152         return ret_conv;
41153 }
41154
41155 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
41156         LDKUnsignedChannelUpdate this_ptr_conv;
41157         this_ptr_conv.inner = untag_ptr(this_ptr);
41158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41160         this_ptr_conv.is_owned = false;
41161         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
41162 }
41163
41164 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
41165         LDKUnsignedChannelUpdate this_ptr_conv;
41166         this_ptr_conv.inner = untag_ptr(this_ptr);
41167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41169         this_ptr_conv.is_owned = false;
41170         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
41171         return ret_conv;
41172 }
41173
41174 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
41175         LDKUnsignedChannelUpdate this_ptr_conv;
41176         this_ptr_conv.inner = untag_ptr(this_ptr);
41177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41179         this_ptr_conv.is_owned = false;
41180         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
41181 }
41182
41183 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
41184         LDKUnsignedChannelUpdate this_ptr_conv;
41185         this_ptr_conv.inner = untag_ptr(this_ptr);
41186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41188         this_ptr_conv.is_owned = false;
41189         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
41190         return ret_conv;
41191 }
41192
41193 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
41194         LDKUnsignedChannelUpdate this_ptr_conv;
41195         this_ptr_conv.inner = untag_ptr(this_ptr);
41196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41198         this_ptr_conv.is_owned = false;
41199         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
41200 }
41201
41202 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
41203         LDKUnsignedChannelUpdate this_ptr_conv;
41204         this_ptr_conv.inner = untag_ptr(this_ptr);
41205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41207         this_ptr_conv.is_owned = false;
41208         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
41209         return ret_conv;
41210 }
41211
41212 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
41213         LDKUnsignedChannelUpdate this_ptr_conv;
41214         this_ptr_conv.inner = untag_ptr(this_ptr);
41215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41217         this_ptr_conv.is_owned = false;
41218         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
41219 }
41220
41221 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
41222         LDKUnsignedChannelUpdate this_ptr_conv;
41223         this_ptr_conv.inner = untag_ptr(this_ptr);
41224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41226         this_ptr_conv.is_owned = false;
41227         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
41228         return ret_conv;
41229 }
41230
41231 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
41232         LDKUnsignedChannelUpdate this_ptr_conv;
41233         this_ptr_conv.inner = untag_ptr(this_ptr);
41234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41236         this_ptr_conv.is_owned = false;
41237         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
41238 }
41239
41240 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
41241         LDKUnsignedChannelUpdate this_ptr_conv;
41242         this_ptr_conv.inner = untag_ptr(this_ptr);
41243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41245         this_ptr_conv.is_owned = false;
41246         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
41247         return ret_conv;
41248 }
41249
41250 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
41251         LDKUnsignedChannelUpdate this_ptr_conv;
41252         this_ptr_conv.inner = untag_ptr(this_ptr);
41253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41255         this_ptr_conv.is_owned = false;
41256         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
41257 }
41258
41259 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
41260         LDKUnsignedChannelUpdate 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         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
41266         return ret_conv;
41267 }
41268
41269 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
41270         LDKUnsignedChannelUpdate this_ptr_conv;
41271         this_ptr_conv.inner = untag_ptr(this_ptr);
41272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41274         this_ptr_conv.is_owned = false;
41275         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
41276 }
41277
41278 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
41279         LDKUnsignedChannelUpdate this_ptr_conv;
41280         this_ptr_conv.inner = untag_ptr(this_ptr);
41281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41283         this_ptr_conv.is_owned = false;
41284         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
41285         return ret_conv;
41286 }
41287
41288 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
41289         LDKUnsignedChannelUpdate this_ptr_conv;
41290         this_ptr_conv.inner = untag_ptr(this_ptr);
41291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41293         this_ptr_conv.is_owned = false;
41294         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
41295 }
41296
41297 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
41298         LDKUnsignedChannelUpdate this_ptr_conv;
41299         this_ptr_conv.inner = untag_ptr(this_ptr);
41300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41302         this_ptr_conv.is_owned = false;
41303         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
41304         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41305         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41306         CVec_u8Z_free(ret_var);
41307         return ret_arr;
41308 }
41309
41310 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
41311         LDKUnsignedChannelUpdate this_ptr_conv;
41312         this_ptr_conv.inner = untag_ptr(this_ptr);
41313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41315         this_ptr_conv.is_owned = false;
41316         LDKCVec_u8Z val_ref;
41317         val_ref.datalen = val->arr_len;
41318         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41319         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
41320         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
41321 }
41322
41323 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) {
41324         LDKThirtyTwoBytes chain_hash_arg_ref;
41325         CHECK(chain_hash_arg->arr_len == 32);
41326         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41327         LDKCVec_u8Z excess_data_arg_ref;
41328         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
41329         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41330         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
41331         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);
41332         uint64_t ret_ref = 0;
41333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41335         return ret_ref;
41336 }
41337
41338 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
41339         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
41340         uint64_t ret_ref = 0;
41341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41343         return ret_ref;
41344 }
41345 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
41346         LDKUnsignedChannelUpdate arg_conv;
41347         arg_conv.inner = untag_ptr(arg);
41348         arg_conv.is_owned = ptr_is_owned(arg);
41349         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41350         arg_conv.is_owned = false;
41351         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
41352         return ret_conv;
41353 }
41354
41355 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
41356         LDKUnsignedChannelUpdate orig_conv;
41357         orig_conv.inner = untag_ptr(orig);
41358         orig_conv.is_owned = ptr_is_owned(orig);
41359         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41360         orig_conv.is_owned = false;
41361         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
41362         uint64_t ret_ref = 0;
41363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41365         return ret_ref;
41366 }
41367
41368 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
41369         LDKUnsignedChannelUpdate a_conv;
41370         a_conv.inner = untag_ptr(a);
41371         a_conv.is_owned = ptr_is_owned(a);
41372         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41373         a_conv.is_owned = false;
41374         LDKUnsignedChannelUpdate b_conv;
41375         b_conv.inner = untag_ptr(b);
41376         b_conv.is_owned = ptr_is_owned(b);
41377         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41378         b_conv.is_owned = false;
41379         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
41380         return ret_conv;
41381 }
41382
41383 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
41384         LDKChannelUpdate this_obj_conv;
41385         this_obj_conv.inner = untag_ptr(this_obj);
41386         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41388         ChannelUpdate_free(this_obj_conv);
41389 }
41390
41391 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
41392         LDKChannelUpdate this_ptr_conv;
41393         this_ptr_conv.inner = untag_ptr(this_ptr);
41394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41396         this_ptr_conv.is_owned = false;
41397         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
41398         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
41399         return ret_arr;
41400 }
41401
41402 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
41403         LDKChannelUpdate this_ptr_conv;
41404         this_ptr_conv.inner = untag_ptr(this_ptr);
41405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41407         this_ptr_conv.is_owned = false;
41408         LDKSignature val_ref;
41409         CHECK(val->arr_len == 64);
41410         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
41411         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
41412 }
41413
41414 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
41415         LDKChannelUpdate this_ptr_conv;
41416         this_ptr_conv.inner = untag_ptr(this_ptr);
41417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41419         this_ptr_conv.is_owned = false;
41420         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
41421         uint64_t ret_ref = 0;
41422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41424         return ret_ref;
41425 }
41426
41427 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
41428         LDKChannelUpdate this_ptr_conv;
41429         this_ptr_conv.inner = untag_ptr(this_ptr);
41430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41432         this_ptr_conv.is_owned = false;
41433         LDKUnsignedChannelUpdate val_conv;
41434         val_conv.inner = untag_ptr(val);
41435         val_conv.is_owned = ptr_is_owned(val);
41436         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41437         val_conv = UnsignedChannelUpdate_clone(&val_conv);
41438         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
41439 }
41440
41441 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
41442         LDKSignature signature_arg_ref;
41443         CHECK(signature_arg->arr_len == 64);
41444         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
41445         LDKUnsignedChannelUpdate contents_arg_conv;
41446         contents_arg_conv.inner = untag_ptr(contents_arg);
41447         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
41449         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
41450         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
41451         uint64_t ret_ref = 0;
41452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41454         return ret_ref;
41455 }
41456
41457 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
41458         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
41459         uint64_t ret_ref = 0;
41460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41462         return ret_ref;
41463 }
41464 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
41465         LDKChannelUpdate arg_conv;
41466         arg_conv.inner = untag_ptr(arg);
41467         arg_conv.is_owned = ptr_is_owned(arg);
41468         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41469         arg_conv.is_owned = false;
41470         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
41471         return ret_conv;
41472 }
41473
41474 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
41475         LDKChannelUpdate orig_conv;
41476         orig_conv.inner = untag_ptr(orig);
41477         orig_conv.is_owned = ptr_is_owned(orig);
41478         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41479         orig_conv.is_owned = false;
41480         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
41481         uint64_t ret_ref = 0;
41482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41484         return ret_ref;
41485 }
41486
41487 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
41488         LDKChannelUpdate a_conv;
41489         a_conv.inner = untag_ptr(a);
41490         a_conv.is_owned = ptr_is_owned(a);
41491         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41492         a_conv.is_owned = false;
41493         LDKChannelUpdate b_conv;
41494         b_conv.inner = untag_ptr(b);
41495         b_conv.is_owned = ptr_is_owned(b);
41496         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41497         b_conv.is_owned = false;
41498         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
41499         return ret_conv;
41500 }
41501
41502 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
41503         LDKQueryChannelRange this_obj_conv;
41504         this_obj_conv.inner = untag_ptr(this_obj);
41505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41507         QueryChannelRange_free(this_obj_conv);
41508 }
41509
41510 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
41511         LDKQueryChannelRange 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41517         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
41518         return ret_arr;
41519 }
41520
41521 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41522         LDKQueryChannelRange this_ptr_conv;
41523         this_ptr_conv.inner = untag_ptr(this_ptr);
41524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41526         this_ptr_conv.is_owned = false;
41527         LDKThirtyTwoBytes val_ref;
41528         CHECK(val->arr_len == 32);
41529         memcpy(val_ref.data, val->elems, 32); FREE(val);
41530         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
41531 }
41532
41533 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
41534         LDKQueryChannelRange 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         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
41540         return ret_conv;
41541 }
41542
41543 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
41544         LDKQueryChannelRange this_ptr_conv;
41545         this_ptr_conv.inner = untag_ptr(this_ptr);
41546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41548         this_ptr_conv.is_owned = false;
41549         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
41550 }
41551
41552 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
41553         LDKQueryChannelRange this_ptr_conv;
41554         this_ptr_conv.inner = untag_ptr(this_ptr);
41555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41557         this_ptr_conv.is_owned = false;
41558         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
41559         return ret_conv;
41560 }
41561
41562 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
41563         LDKQueryChannelRange this_ptr_conv;
41564         this_ptr_conv.inner = untag_ptr(this_ptr);
41565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41567         this_ptr_conv.is_owned = false;
41568         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
41569 }
41570
41571 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) {
41572         LDKThirtyTwoBytes chain_hash_arg_ref;
41573         CHECK(chain_hash_arg->arr_len == 32);
41574         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41575         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
41576         uint64_t ret_ref = 0;
41577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41579         return ret_ref;
41580 }
41581
41582 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
41583         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
41584         uint64_t ret_ref = 0;
41585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41587         return ret_ref;
41588 }
41589 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
41590         LDKQueryChannelRange arg_conv;
41591         arg_conv.inner = untag_ptr(arg);
41592         arg_conv.is_owned = ptr_is_owned(arg);
41593         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41594         arg_conv.is_owned = false;
41595         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
41596         return ret_conv;
41597 }
41598
41599 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
41600         LDKQueryChannelRange orig_conv;
41601         orig_conv.inner = untag_ptr(orig);
41602         orig_conv.is_owned = ptr_is_owned(orig);
41603         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41604         orig_conv.is_owned = false;
41605         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
41606         uint64_t ret_ref = 0;
41607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41609         return ret_ref;
41610 }
41611
41612 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
41613         LDKQueryChannelRange a_conv;
41614         a_conv.inner = untag_ptr(a);
41615         a_conv.is_owned = ptr_is_owned(a);
41616         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41617         a_conv.is_owned = false;
41618         LDKQueryChannelRange b_conv;
41619         b_conv.inner = untag_ptr(b);
41620         b_conv.is_owned = ptr_is_owned(b);
41621         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41622         b_conv.is_owned = false;
41623         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
41624         return ret_conv;
41625 }
41626
41627 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
41628         LDKReplyChannelRange this_obj_conv;
41629         this_obj_conv.inner = untag_ptr(this_obj);
41630         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41632         ReplyChannelRange_free(this_obj_conv);
41633 }
41634
41635 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
41636         LDKReplyChannelRange 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41642         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
41643         return ret_arr;
41644 }
41645
41646 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41647         LDKReplyChannelRange this_ptr_conv;
41648         this_ptr_conv.inner = untag_ptr(this_ptr);
41649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41651         this_ptr_conv.is_owned = false;
41652         LDKThirtyTwoBytes val_ref;
41653         CHECK(val->arr_len == 32);
41654         memcpy(val_ref.data, val->elems, 32); FREE(val);
41655         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
41656 }
41657
41658 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
41659         LDKReplyChannelRange this_ptr_conv;
41660         this_ptr_conv.inner = untag_ptr(this_ptr);
41661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41663         this_ptr_conv.is_owned = false;
41664         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
41665         return ret_conv;
41666 }
41667
41668 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
41669         LDKReplyChannelRange this_ptr_conv;
41670         this_ptr_conv.inner = untag_ptr(this_ptr);
41671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41673         this_ptr_conv.is_owned = false;
41674         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
41675 }
41676
41677 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
41678         LDKReplyChannelRange this_ptr_conv;
41679         this_ptr_conv.inner = untag_ptr(this_ptr);
41680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41682         this_ptr_conv.is_owned = false;
41683         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
41684         return ret_conv;
41685 }
41686
41687 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
41688         LDKReplyChannelRange this_ptr_conv;
41689         this_ptr_conv.inner = untag_ptr(this_ptr);
41690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41692         this_ptr_conv.is_owned = false;
41693         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
41694 }
41695
41696 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
41697         LDKReplyChannelRange this_ptr_conv;
41698         this_ptr_conv.inner = untag_ptr(this_ptr);
41699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41701         this_ptr_conv.is_owned = false;
41702         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
41703         return ret_conv;
41704 }
41705
41706 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
41707         LDKReplyChannelRange this_ptr_conv;
41708         this_ptr_conv.inner = untag_ptr(this_ptr);
41709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41711         this_ptr_conv.is_owned = false;
41712         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
41713 }
41714
41715 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
41716         LDKReplyChannelRange this_ptr_conv;
41717         this_ptr_conv.inner = untag_ptr(this_ptr);
41718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41720         this_ptr_conv.is_owned = false;
41721         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
41722         int64_tArray ret_arr = NULL;
41723         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41724         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41725         for (size_t i = 0; i < ret_var.datalen; i++) {
41726                 int64_t ret_conv_8_conv = ret_var.data[i];
41727                 ret_arr_ptr[i] = ret_conv_8_conv;
41728         }
41729         
41730         FREE(ret_var.data);
41731         return ret_arr;
41732 }
41733
41734 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
41735         LDKReplyChannelRange this_ptr_conv;
41736         this_ptr_conv.inner = untag_ptr(this_ptr);
41737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41739         this_ptr_conv.is_owned = false;
41740         LDKCVec_u64Z val_constr;
41741         val_constr.datalen = val->arr_len;
41742         if (val_constr.datalen > 0)
41743                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41744         else
41745                 val_constr.data = NULL;
41746         int64_t* val_vals = val->elems;
41747         for (size_t i = 0; i < val_constr.datalen; i++) {
41748                 int64_t val_conv_8 = val_vals[i];
41749                 val_constr.data[i] = val_conv_8;
41750         }
41751         FREE(val);
41752         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
41753 }
41754
41755 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) {
41756         LDKThirtyTwoBytes chain_hash_arg_ref;
41757         CHECK(chain_hash_arg->arr_len == 32);
41758         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41759         LDKCVec_u64Z short_channel_ids_arg_constr;
41760         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
41761         if (short_channel_ids_arg_constr.datalen > 0)
41762                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41763         else
41764                 short_channel_ids_arg_constr.data = NULL;
41765         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
41766         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
41767                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
41768                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
41769         }
41770         FREE(short_channel_ids_arg);
41771         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
41772         uint64_t ret_ref = 0;
41773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41775         return ret_ref;
41776 }
41777
41778 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
41779         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
41780         uint64_t ret_ref = 0;
41781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41783         return ret_ref;
41784 }
41785 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
41786         LDKReplyChannelRange arg_conv;
41787         arg_conv.inner = untag_ptr(arg);
41788         arg_conv.is_owned = ptr_is_owned(arg);
41789         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41790         arg_conv.is_owned = false;
41791         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
41792         return ret_conv;
41793 }
41794
41795 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
41796         LDKReplyChannelRange orig_conv;
41797         orig_conv.inner = untag_ptr(orig);
41798         orig_conv.is_owned = ptr_is_owned(orig);
41799         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41800         orig_conv.is_owned = false;
41801         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
41802         uint64_t ret_ref = 0;
41803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41805         return ret_ref;
41806 }
41807
41808 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
41809         LDKReplyChannelRange a_conv;
41810         a_conv.inner = untag_ptr(a);
41811         a_conv.is_owned = ptr_is_owned(a);
41812         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41813         a_conv.is_owned = false;
41814         LDKReplyChannelRange b_conv;
41815         b_conv.inner = untag_ptr(b);
41816         b_conv.is_owned = ptr_is_owned(b);
41817         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41818         b_conv.is_owned = false;
41819         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
41820         return ret_conv;
41821 }
41822
41823 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
41824         LDKQueryShortChannelIds this_obj_conv;
41825         this_obj_conv.inner = untag_ptr(this_obj);
41826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41828         QueryShortChannelIds_free(this_obj_conv);
41829 }
41830
41831 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
41832         LDKQueryShortChannelIds 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41838         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
41839         return ret_arr;
41840 }
41841
41842 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41843         LDKQueryShortChannelIds this_ptr_conv;
41844         this_ptr_conv.inner = untag_ptr(this_ptr);
41845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41847         this_ptr_conv.is_owned = false;
41848         LDKThirtyTwoBytes val_ref;
41849         CHECK(val->arr_len == 32);
41850         memcpy(val_ref.data, val->elems, 32); FREE(val);
41851         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
41852 }
41853
41854 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
41855         LDKQueryShortChannelIds this_ptr_conv;
41856         this_ptr_conv.inner = untag_ptr(this_ptr);
41857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41859         this_ptr_conv.is_owned = false;
41860         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
41861         int64_tArray ret_arr = NULL;
41862         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41863         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41864         for (size_t i = 0; i < ret_var.datalen; i++) {
41865                 int64_t ret_conv_8_conv = ret_var.data[i];
41866                 ret_arr_ptr[i] = ret_conv_8_conv;
41867         }
41868         
41869         FREE(ret_var.data);
41870         return ret_arr;
41871 }
41872
41873 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
41874         LDKQueryShortChannelIds this_ptr_conv;
41875         this_ptr_conv.inner = untag_ptr(this_ptr);
41876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41878         this_ptr_conv.is_owned = false;
41879         LDKCVec_u64Z val_constr;
41880         val_constr.datalen = val->arr_len;
41881         if (val_constr.datalen > 0)
41882                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41883         else
41884                 val_constr.data = NULL;
41885         int64_t* val_vals = val->elems;
41886         for (size_t i = 0; i < val_constr.datalen; i++) {
41887                 int64_t val_conv_8 = val_vals[i];
41888                 val_constr.data[i] = val_conv_8;
41889         }
41890         FREE(val);
41891         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
41892 }
41893
41894 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
41895         LDKThirtyTwoBytes chain_hash_arg_ref;
41896         CHECK(chain_hash_arg->arr_len == 32);
41897         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41898         LDKCVec_u64Z short_channel_ids_arg_constr;
41899         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
41900         if (short_channel_ids_arg_constr.datalen > 0)
41901                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41902         else
41903                 short_channel_ids_arg_constr.data = NULL;
41904         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
41905         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
41906                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
41907                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
41908         }
41909         FREE(short_channel_ids_arg);
41910         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
41911         uint64_t ret_ref = 0;
41912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41914         return ret_ref;
41915 }
41916
41917 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
41918         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
41919         uint64_t ret_ref = 0;
41920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41922         return ret_ref;
41923 }
41924 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
41925         LDKQueryShortChannelIds arg_conv;
41926         arg_conv.inner = untag_ptr(arg);
41927         arg_conv.is_owned = ptr_is_owned(arg);
41928         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41929         arg_conv.is_owned = false;
41930         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
41931         return ret_conv;
41932 }
41933
41934 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
41935         LDKQueryShortChannelIds orig_conv;
41936         orig_conv.inner = untag_ptr(orig);
41937         orig_conv.is_owned = ptr_is_owned(orig);
41938         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41939         orig_conv.is_owned = false;
41940         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
41941         uint64_t ret_ref = 0;
41942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41944         return ret_ref;
41945 }
41946
41947 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
41948         LDKQueryShortChannelIds a_conv;
41949         a_conv.inner = untag_ptr(a);
41950         a_conv.is_owned = ptr_is_owned(a);
41951         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41952         a_conv.is_owned = false;
41953         LDKQueryShortChannelIds b_conv;
41954         b_conv.inner = untag_ptr(b);
41955         b_conv.is_owned = ptr_is_owned(b);
41956         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41957         b_conv.is_owned = false;
41958         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
41959         return ret_conv;
41960 }
41961
41962 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
41963         LDKReplyShortChannelIdsEnd this_obj_conv;
41964         this_obj_conv.inner = untag_ptr(this_obj);
41965         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41967         ReplyShortChannelIdsEnd_free(this_obj_conv);
41968 }
41969
41970 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
41971         LDKReplyShortChannelIdsEnd this_ptr_conv;
41972         this_ptr_conv.inner = untag_ptr(this_ptr);
41973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41975         this_ptr_conv.is_owned = false;
41976         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41977         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
41978         return ret_arr;
41979 }
41980
41981 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41982         LDKReplyShortChannelIdsEnd this_ptr_conv;
41983         this_ptr_conv.inner = untag_ptr(this_ptr);
41984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41986         this_ptr_conv.is_owned = false;
41987         LDKThirtyTwoBytes val_ref;
41988         CHECK(val->arr_len == 32);
41989         memcpy(val_ref.data, val->elems, 32); FREE(val);
41990         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
41991 }
41992
41993 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
41994         LDKReplyShortChannelIdsEnd this_ptr_conv;
41995         this_ptr_conv.inner = untag_ptr(this_ptr);
41996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41998         this_ptr_conv.is_owned = false;
41999         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
42000         return ret_conv;
42001 }
42002
42003 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
42004         LDKReplyShortChannelIdsEnd this_ptr_conv;
42005         this_ptr_conv.inner = untag_ptr(this_ptr);
42006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42008         this_ptr_conv.is_owned = false;
42009         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
42010 }
42011
42012 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
42013         LDKThirtyTwoBytes chain_hash_arg_ref;
42014         CHECK(chain_hash_arg->arr_len == 32);
42015         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42016         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
42017         uint64_t ret_ref = 0;
42018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42020         return ret_ref;
42021 }
42022
42023 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
42024         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
42025         uint64_t ret_ref = 0;
42026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42028         return ret_ref;
42029 }
42030 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
42031         LDKReplyShortChannelIdsEnd arg_conv;
42032         arg_conv.inner = untag_ptr(arg);
42033         arg_conv.is_owned = ptr_is_owned(arg);
42034         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42035         arg_conv.is_owned = false;
42036         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
42037         return ret_conv;
42038 }
42039
42040 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
42041         LDKReplyShortChannelIdsEnd orig_conv;
42042         orig_conv.inner = untag_ptr(orig);
42043         orig_conv.is_owned = ptr_is_owned(orig);
42044         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42045         orig_conv.is_owned = false;
42046         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
42047         uint64_t ret_ref = 0;
42048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42050         return ret_ref;
42051 }
42052
42053 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
42054         LDKReplyShortChannelIdsEnd a_conv;
42055         a_conv.inner = untag_ptr(a);
42056         a_conv.is_owned = ptr_is_owned(a);
42057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42058         a_conv.is_owned = false;
42059         LDKReplyShortChannelIdsEnd b_conv;
42060         b_conv.inner = untag_ptr(b);
42061         b_conv.is_owned = ptr_is_owned(b);
42062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42063         b_conv.is_owned = false;
42064         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
42065         return ret_conv;
42066 }
42067
42068 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
42069         LDKGossipTimestampFilter this_obj_conv;
42070         this_obj_conv.inner = untag_ptr(this_obj);
42071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42073         GossipTimestampFilter_free(this_obj_conv);
42074 }
42075
42076 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
42077         LDKGossipTimestampFilter this_ptr_conv;
42078         this_ptr_conv.inner = untag_ptr(this_ptr);
42079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42081         this_ptr_conv.is_owned = false;
42082         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42083         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
42084         return ret_arr;
42085 }
42086
42087 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
42088         LDKGossipTimestampFilter this_ptr_conv;
42089         this_ptr_conv.inner = untag_ptr(this_ptr);
42090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42092         this_ptr_conv.is_owned = false;
42093         LDKThirtyTwoBytes val_ref;
42094         CHECK(val->arr_len == 32);
42095         memcpy(val_ref.data, val->elems, 32); FREE(val);
42096         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
42097 }
42098
42099 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
42100         LDKGossipTimestampFilter this_ptr_conv;
42101         this_ptr_conv.inner = untag_ptr(this_ptr);
42102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42104         this_ptr_conv.is_owned = false;
42105         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
42106         return ret_conv;
42107 }
42108
42109 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
42110         LDKGossipTimestampFilter 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         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
42116 }
42117
42118 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
42119         LDKGossipTimestampFilter this_ptr_conv;
42120         this_ptr_conv.inner = untag_ptr(this_ptr);
42121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42123         this_ptr_conv.is_owned = false;
42124         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
42125         return ret_conv;
42126 }
42127
42128 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
42129         LDKGossipTimestampFilter this_ptr_conv;
42130         this_ptr_conv.inner = untag_ptr(this_ptr);
42131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42133         this_ptr_conv.is_owned = false;
42134         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
42135 }
42136
42137 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) {
42138         LDKThirtyTwoBytes chain_hash_arg_ref;
42139         CHECK(chain_hash_arg->arr_len == 32);
42140         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42141         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
42142         uint64_t ret_ref = 0;
42143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42145         return ret_ref;
42146 }
42147
42148 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
42149         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
42150         uint64_t ret_ref = 0;
42151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42153         return ret_ref;
42154 }
42155 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
42156         LDKGossipTimestampFilter arg_conv;
42157         arg_conv.inner = untag_ptr(arg);
42158         arg_conv.is_owned = ptr_is_owned(arg);
42159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42160         arg_conv.is_owned = false;
42161         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
42162         return ret_conv;
42163 }
42164
42165 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
42166         LDKGossipTimestampFilter orig_conv;
42167         orig_conv.inner = untag_ptr(orig);
42168         orig_conv.is_owned = ptr_is_owned(orig);
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42170         orig_conv.is_owned = false;
42171         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
42172         uint64_t ret_ref = 0;
42173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42175         return ret_ref;
42176 }
42177
42178 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
42179         LDKGossipTimestampFilter a_conv;
42180         a_conv.inner = untag_ptr(a);
42181         a_conv.is_owned = ptr_is_owned(a);
42182         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42183         a_conv.is_owned = false;
42184         LDKGossipTimestampFilter b_conv;
42185         b_conv.inner = untag_ptr(b);
42186         b_conv.is_owned = ptr_is_owned(b);
42187         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42188         b_conv.is_owned = false;
42189         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
42190         return ret_conv;
42191 }
42192
42193 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
42194         if (!ptr_is_owned(this_ptr)) return;
42195         void* this_ptr_ptr = untag_ptr(this_ptr);
42196         CHECK_ACCESS(this_ptr_ptr);
42197         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
42198         FREE(untag_ptr(this_ptr));
42199         ErrorAction_free(this_ptr_conv);
42200 }
42201
42202 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
42203         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42204         *ret_copy = ErrorAction_clone(arg);
42205         uint64_t ret_ref = tag_ptr(ret_copy, true);
42206         return ret_ref;
42207 }
42208 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
42209         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
42210         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
42211         return ret_conv;
42212 }
42213
42214 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
42215         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
42216         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42217         *ret_copy = ErrorAction_clone(orig_conv);
42218         uint64_t ret_ref = tag_ptr(ret_copy, true);
42219         return ret_ref;
42220 }
42221
42222 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
42223         LDKErrorMessage msg_conv;
42224         msg_conv.inner = untag_ptr(msg);
42225         msg_conv.is_owned = ptr_is_owned(msg);
42226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42227         msg_conv = ErrorMessage_clone(&msg_conv);
42228         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42229         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
42230         uint64_t ret_ref = tag_ptr(ret_copy, true);
42231         return ret_ref;
42232 }
42233
42234 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
42235         LDKWarningMessage msg_conv;
42236         msg_conv.inner = untag_ptr(msg);
42237         msg_conv.is_owned = ptr_is_owned(msg);
42238         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42239         msg_conv = WarningMessage_clone(&msg_conv);
42240         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42241         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
42242         uint64_t ret_ref = tag_ptr(ret_copy, true);
42243         return ret_ref;
42244 }
42245
42246 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
42247         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42248         *ret_copy = ErrorAction_ignore_error();
42249         uint64_t ret_ref = tag_ptr(ret_copy, true);
42250         return ret_ref;
42251 }
42252
42253 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
42254         LDKLevel a_conv = LDKLevel_from_js(a);
42255         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42256         *ret_copy = ErrorAction_ignore_and_log(a_conv);
42257         uint64_t ret_ref = tag_ptr(ret_copy, true);
42258         return ret_ref;
42259 }
42260
42261 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
42262         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42263         *ret_copy = ErrorAction_ignore_duplicate_gossip();
42264         uint64_t ret_ref = tag_ptr(ret_copy, true);
42265         return ret_ref;
42266 }
42267
42268 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
42269         LDKErrorMessage msg_conv;
42270         msg_conv.inner = untag_ptr(msg);
42271         msg_conv.is_owned = ptr_is_owned(msg);
42272         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42273         msg_conv = ErrorMessage_clone(&msg_conv);
42274         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42275         *ret_copy = ErrorAction_send_error_message(msg_conv);
42276         uint64_t ret_ref = tag_ptr(ret_copy, true);
42277         return ret_ref;
42278 }
42279
42280 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
42281         LDKWarningMessage msg_conv;
42282         msg_conv.inner = untag_ptr(msg);
42283         msg_conv.is_owned = ptr_is_owned(msg);
42284         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42285         msg_conv = WarningMessage_clone(&msg_conv);
42286         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
42287         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42288         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
42289         uint64_t ret_ref = tag_ptr(ret_copy, true);
42290         return ret_ref;
42291 }
42292
42293 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
42294         LDKLightningError this_obj_conv;
42295         this_obj_conv.inner = untag_ptr(this_obj);
42296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42298         LightningError_free(this_obj_conv);
42299 }
42300
42301 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
42302         LDKLightningError this_ptr_conv;
42303         this_ptr_conv.inner = untag_ptr(this_ptr);
42304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42306         this_ptr_conv.is_owned = false;
42307         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
42308         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
42309         Str_free(ret_str);
42310         return ret_conv;
42311 }
42312
42313 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
42314         LDKLightningError this_ptr_conv;
42315         this_ptr_conv.inner = untag_ptr(this_ptr);
42316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42318         this_ptr_conv.is_owned = false;
42319         LDKStr val_conv = str_ref_to_owned_c(val);
42320         LightningError_set_err(&this_ptr_conv, val_conv);
42321 }
42322
42323 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
42324         LDKLightningError this_ptr_conv;
42325         this_ptr_conv.inner = untag_ptr(this_ptr);
42326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42328         this_ptr_conv.is_owned = false;
42329         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42330         *ret_copy = LightningError_get_action(&this_ptr_conv);
42331         uint64_t ret_ref = tag_ptr(ret_copy, true);
42332         return ret_ref;
42333 }
42334
42335 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
42336         LDKLightningError this_ptr_conv;
42337         this_ptr_conv.inner = untag_ptr(this_ptr);
42338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42340         this_ptr_conv.is_owned = false;
42341         void* val_ptr = untag_ptr(val);
42342         CHECK_ACCESS(val_ptr);
42343         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
42344         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
42345         LightningError_set_action(&this_ptr_conv, val_conv);
42346 }
42347
42348 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
42349         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
42350         void* action_arg_ptr = untag_ptr(action_arg);
42351         CHECK_ACCESS(action_arg_ptr);
42352         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
42353         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
42354         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
42355         uint64_t ret_ref = 0;
42356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42358         return ret_ref;
42359 }
42360
42361 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
42362         LDKLightningError ret_var = LightningError_clone(arg);
42363         uint64_t ret_ref = 0;
42364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42366         return ret_ref;
42367 }
42368 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
42369         LDKLightningError arg_conv;
42370         arg_conv.inner = untag_ptr(arg);
42371         arg_conv.is_owned = ptr_is_owned(arg);
42372         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42373         arg_conv.is_owned = false;
42374         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
42375         return ret_conv;
42376 }
42377
42378 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
42379         LDKLightningError orig_conv;
42380         orig_conv.inner = untag_ptr(orig);
42381         orig_conv.is_owned = ptr_is_owned(orig);
42382         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42383         orig_conv.is_owned = false;
42384         LDKLightningError ret_var = LightningError_clone(&orig_conv);
42385         uint64_t ret_ref = 0;
42386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42388         return ret_ref;
42389 }
42390
42391 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
42392         LDKCommitmentUpdate this_obj_conv;
42393         this_obj_conv.inner = untag_ptr(this_obj);
42394         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42396         CommitmentUpdate_free(this_obj_conv);
42397 }
42398
42399 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
42400         LDKCommitmentUpdate this_ptr_conv;
42401         this_ptr_conv.inner = untag_ptr(this_ptr);
42402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42404         this_ptr_conv.is_owned = false;
42405         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
42406         uint64_tArray ret_arr = NULL;
42407         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42408         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42409         for (size_t p = 0; p < ret_var.datalen; p++) {
42410                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
42411                 uint64_t ret_conv_15_ref = 0;
42412                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
42413                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
42414                 ret_arr_ptr[p] = ret_conv_15_ref;
42415         }
42416         
42417         FREE(ret_var.data);
42418         return ret_arr;
42419 }
42420
42421 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
42422         LDKCommitmentUpdate this_ptr_conv;
42423         this_ptr_conv.inner = untag_ptr(this_ptr);
42424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42426         this_ptr_conv.is_owned = false;
42427         LDKCVec_UpdateAddHTLCZ val_constr;
42428         val_constr.datalen = val->arr_len;
42429         if (val_constr.datalen > 0)
42430                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
42431         else
42432                 val_constr.data = NULL;
42433         uint64_t* val_vals = val->elems;
42434         for (size_t p = 0; p < val_constr.datalen; p++) {
42435                 uint64_t val_conv_15 = val_vals[p];
42436                 LDKUpdateAddHTLC val_conv_15_conv;
42437                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
42438                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
42439                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
42440                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
42441                 val_constr.data[p] = val_conv_15_conv;
42442         }
42443         FREE(val);
42444         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
42445 }
42446
42447 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
42448         LDKCommitmentUpdate this_ptr_conv;
42449         this_ptr_conv.inner = untag_ptr(this_ptr);
42450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42452         this_ptr_conv.is_owned = false;
42453         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
42454         uint64_tArray ret_arr = NULL;
42455         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42456         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42457         for (size_t t = 0; t < ret_var.datalen; t++) {
42458                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
42459                 uint64_t ret_conv_19_ref = 0;
42460                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
42461                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
42462                 ret_arr_ptr[t] = ret_conv_19_ref;
42463         }
42464         
42465         FREE(ret_var.data);
42466         return ret_arr;
42467 }
42468
42469 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
42470         LDKCommitmentUpdate this_ptr_conv;
42471         this_ptr_conv.inner = untag_ptr(this_ptr);
42472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42474         this_ptr_conv.is_owned = false;
42475         LDKCVec_UpdateFulfillHTLCZ val_constr;
42476         val_constr.datalen = val->arr_len;
42477         if (val_constr.datalen > 0)
42478                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
42479         else
42480                 val_constr.data = NULL;
42481         uint64_t* val_vals = val->elems;
42482         for (size_t t = 0; t < val_constr.datalen; t++) {
42483                 uint64_t val_conv_19 = val_vals[t];
42484                 LDKUpdateFulfillHTLC val_conv_19_conv;
42485                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
42486                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
42487                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
42488                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
42489                 val_constr.data[t] = val_conv_19_conv;
42490         }
42491         FREE(val);
42492         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
42493 }
42494
42495 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
42496         LDKCommitmentUpdate this_ptr_conv;
42497         this_ptr_conv.inner = untag_ptr(this_ptr);
42498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42500         this_ptr_conv.is_owned = false;
42501         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
42502         uint64_tArray ret_arr = NULL;
42503         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42504         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42505         for (size_t q = 0; q < ret_var.datalen; q++) {
42506                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
42507                 uint64_t ret_conv_16_ref = 0;
42508                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42509                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42510                 ret_arr_ptr[q] = ret_conv_16_ref;
42511         }
42512         
42513         FREE(ret_var.data);
42514         return ret_arr;
42515 }
42516
42517 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
42518         LDKCommitmentUpdate this_ptr_conv;
42519         this_ptr_conv.inner = untag_ptr(this_ptr);
42520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42522         this_ptr_conv.is_owned = false;
42523         LDKCVec_UpdateFailHTLCZ val_constr;
42524         val_constr.datalen = val->arr_len;
42525         if (val_constr.datalen > 0)
42526                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
42527         else
42528                 val_constr.data = NULL;
42529         uint64_t* val_vals = val->elems;
42530         for (size_t q = 0; q < val_constr.datalen; q++) {
42531                 uint64_t val_conv_16 = val_vals[q];
42532                 LDKUpdateFailHTLC val_conv_16_conv;
42533                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
42534                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
42535                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
42536                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
42537                 val_constr.data[q] = val_conv_16_conv;
42538         }
42539         FREE(val);
42540         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
42541 }
42542
42543 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
42544         LDKCommitmentUpdate this_ptr_conv;
42545         this_ptr_conv.inner = untag_ptr(this_ptr);
42546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42548         this_ptr_conv.is_owned = false;
42549         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
42550         uint64_tArray ret_arr = NULL;
42551         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42552         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42553         for (size_t z = 0; z < ret_var.datalen; z++) {
42554                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
42555                 uint64_t ret_conv_25_ref = 0;
42556                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
42557                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
42558                 ret_arr_ptr[z] = ret_conv_25_ref;
42559         }
42560         
42561         FREE(ret_var.data);
42562         return ret_arr;
42563 }
42564
42565 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) {
42566         LDKCommitmentUpdate this_ptr_conv;
42567         this_ptr_conv.inner = untag_ptr(this_ptr);
42568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42570         this_ptr_conv.is_owned = false;
42571         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
42572         val_constr.datalen = val->arr_len;
42573         if (val_constr.datalen > 0)
42574                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
42575         else
42576                 val_constr.data = NULL;
42577         uint64_t* val_vals = val->elems;
42578         for (size_t z = 0; z < val_constr.datalen; z++) {
42579                 uint64_t val_conv_25 = val_vals[z];
42580                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
42581                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
42582                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
42583                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
42584                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
42585                 val_constr.data[z] = val_conv_25_conv;
42586         }
42587         FREE(val);
42588         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
42589 }
42590
42591 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
42592         LDKCommitmentUpdate 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         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
42598         uint64_t ret_ref = 0;
42599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42601         return ret_ref;
42602 }
42603
42604 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
42605         LDKCommitmentUpdate this_ptr_conv;
42606         this_ptr_conv.inner = untag_ptr(this_ptr);
42607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42609         this_ptr_conv.is_owned = false;
42610         LDKUpdateFee val_conv;
42611         val_conv.inner = untag_ptr(val);
42612         val_conv.is_owned = ptr_is_owned(val);
42613         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42614         val_conv = UpdateFee_clone(&val_conv);
42615         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
42616 }
42617
42618 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
42619         LDKCommitmentUpdate this_ptr_conv;
42620         this_ptr_conv.inner = untag_ptr(this_ptr);
42621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42623         this_ptr_conv.is_owned = false;
42624         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
42625         uint64_t ret_ref = 0;
42626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42628         return ret_ref;
42629 }
42630
42631 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
42632         LDKCommitmentUpdate this_ptr_conv;
42633         this_ptr_conv.inner = untag_ptr(this_ptr);
42634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42636         this_ptr_conv.is_owned = false;
42637         LDKCommitmentSigned val_conv;
42638         val_conv.inner = untag_ptr(val);
42639         val_conv.is_owned = ptr_is_owned(val);
42640         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42641         val_conv = CommitmentSigned_clone(&val_conv);
42642         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
42643 }
42644
42645 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) {
42646         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
42647         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
42648         if (update_add_htlcs_arg_constr.datalen > 0)
42649                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
42650         else
42651                 update_add_htlcs_arg_constr.data = NULL;
42652         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
42653         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
42654                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
42655                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
42656                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
42657                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
42658                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
42659                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
42660                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
42661         }
42662         FREE(update_add_htlcs_arg);
42663         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
42664         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
42665         if (update_fulfill_htlcs_arg_constr.datalen > 0)
42666                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
42667         else
42668                 update_fulfill_htlcs_arg_constr.data = NULL;
42669         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
42670         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
42671                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
42672                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
42673                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
42674                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
42675                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
42676                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
42677                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
42678         }
42679         FREE(update_fulfill_htlcs_arg);
42680         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
42681         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
42682         if (update_fail_htlcs_arg_constr.datalen > 0)
42683                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
42684         else
42685                 update_fail_htlcs_arg_constr.data = NULL;
42686         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
42687         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
42688                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
42689                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
42690                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
42691                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
42692                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
42693                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
42694                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
42695         }
42696         FREE(update_fail_htlcs_arg);
42697         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
42698         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
42699         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
42700                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
42701         else
42702                 update_fail_malformed_htlcs_arg_constr.data = NULL;
42703         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
42704         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
42705                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
42706                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
42707                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
42708                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
42709                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
42710                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
42711                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
42712         }
42713         FREE(update_fail_malformed_htlcs_arg);
42714         LDKUpdateFee update_fee_arg_conv;
42715         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
42716         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
42717         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
42718         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
42719         LDKCommitmentSigned commitment_signed_arg_conv;
42720         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
42721         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
42722         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
42723         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
42724         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);
42725         uint64_t ret_ref = 0;
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42728         return ret_ref;
42729 }
42730
42731 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
42732         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
42733         uint64_t ret_ref = 0;
42734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42736         return ret_ref;
42737 }
42738 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
42739         LDKCommitmentUpdate arg_conv;
42740         arg_conv.inner = untag_ptr(arg);
42741         arg_conv.is_owned = ptr_is_owned(arg);
42742         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42743         arg_conv.is_owned = false;
42744         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
42745         return ret_conv;
42746 }
42747
42748 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
42749         LDKCommitmentUpdate orig_conv;
42750         orig_conv.inner = untag_ptr(orig);
42751         orig_conv.is_owned = ptr_is_owned(orig);
42752         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42753         orig_conv.is_owned = false;
42754         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
42755         uint64_t ret_ref = 0;
42756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42758         return ret_ref;
42759 }
42760
42761 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
42762         LDKCommitmentUpdate a_conv;
42763         a_conv.inner = untag_ptr(a);
42764         a_conv.is_owned = ptr_is_owned(a);
42765         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42766         a_conv.is_owned = false;
42767         LDKCommitmentUpdate b_conv;
42768         b_conv.inner = untag_ptr(b);
42769         b_conv.is_owned = ptr_is_owned(b);
42770         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42771         b_conv.is_owned = false;
42772         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
42773         return ret_conv;
42774 }
42775
42776 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
42777         if (!ptr_is_owned(this_ptr)) return;
42778         void* this_ptr_ptr = untag_ptr(this_ptr);
42779         CHECK_ACCESS(this_ptr_ptr);
42780         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
42781         FREE(untag_ptr(this_ptr));
42782         ChannelMessageHandler_free(this_ptr_conv);
42783 }
42784
42785 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
42786         if (!ptr_is_owned(this_ptr)) return;
42787         void* this_ptr_ptr = untag_ptr(this_ptr);
42788         CHECK_ACCESS(this_ptr_ptr);
42789         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
42790         FREE(untag_ptr(this_ptr));
42791         RoutingMessageHandler_free(this_ptr_conv);
42792 }
42793
42794 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
42795         if (!ptr_is_owned(this_ptr)) return;
42796         void* this_ptr_ptr = untag_ptr(this_ptr);
42797         CHECK_ACCESS(this_ptr_ptr);
42798         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
42799         FREE(untag_ptr(this_ptr));
42800         OnionMessageHandler_free(this_ptr_conv);
42801 }
42802
42803 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
42804         LDKAcceptChannel obj_conv;
42805         obj_conv.inner = untag_ptr(obj);
42806         obj_conv.is_owned = ptr_is_owned(obj);
42807         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42808         obj_conv.is_owned = false;
42809         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
42810         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42811         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42812         CVec_u8Z_free(ret_var);
42813         return ret_arr;
42814 }
42815
42816 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
42817         LDKu8slice ser_ref;
42818         ser_ref.datalen = ser->arr_len;
42819         ser_ref.data = ser->elems;
42820         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
42821         *ret_conv = AcceptChannel_read(ser_ref);
42822         FREE(ser);
42823         return tag_ptr(ret_conv, true);
42824 }
42825
42826 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
42827         LDKAcceptChannelV2 obj_conv;
42828         obj_conv.inner = untag_ptr(obj);
42829         obj_conv.is_owned = ptr_is_owned(obj);
42830         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42831         obj_conv.is_owned = false;
42832         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
42833         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42834         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42835         CVec_u8Z_free(ret_var);
42836         return ret_arr;
42837 }
42838
42839 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
42840         LDKu8slice ser_ref;
42841         ser_ref.datalen = ser->arr_len;
42842         ser_ref.data = ser->elems;
42843         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
42844         *ret_conv = AcceptChannelV2_read(ser_ref);
42845         FREE(ser);
42846         return tag_ptr(ret_conv, true);
42847 }
42848
42849 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
42850         LDKTxAddInput obj_conv;
42851         obj_conv.inner = untag_ptr(obj);
42852         obj_conv.is_owned = ptr_is_owned(obj);
42853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42854         obj_conv.is_owned = false;
42855         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
42856         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42857         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42858         CVec_u8Z_free(ret_var);
42859         return ret_arr;
42860 }
42861
42862 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
42863         LDKu8slice ser_ref;
42864         ser_ref.datalen = ser->arr_len;
42865         ser_ref.data = ser->elems;
42866         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
42867         *ret_conv = TxAddInput_read(ser_ref);
42868         FREE(ser);
42869         return tag_ptr(ret_conv, true);
42870 }
42871
42872 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
42873         LDKTxAddOutput obj_conv;
42874         obj_conv.inner = untag_ptr(obj);
42875         obj_conv.is_owned = ptr_is_owned(obj);
42876         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42877         obj_conv.is_owned = false;
42878         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
42879         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42880         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42881         CVec_u8Z_free(ret_var);
42882         return ret_arr;
42883 }
42884
42885 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
42886         LDKu8slice ser_ref;
42887         ser_ref.datalen = ser->arr_len;
42888         ser_ref.data = ser->elems;
42889         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
42890         *ret_conv = TxAddOutput_read(ser_ref);
42891         FREE(ser);
42892         return tag_ptr(ret_conv, true);
42893 }
42894
42895 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
42896         LDKTxRemoveInput obj_conv;
42897         obj_conv.inner = untag_ptr(obj);
42898         obj_conv.is_owned = ptr_is_owned(obj);
42899         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42900         obj_conv.is_owned = false;
42901         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
42902         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42903         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42904         CVec_u8Z_free(ret_var);
42905         return ret_arr;
42906 }
42907
42908 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
42909         LDKu8slice ser_ref;
42910         ser_ref.datalen = ser->arr_len;
42911         ser_ref.data = ser->elems;
42912         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
42913         *ret_conv = TxRemoveInput_read(ser_ref);
42914         FREE(ser);
42915         return tag_ptr(ret_conv, true);
42916 }
42917
42918 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
42919         LDKTxRemoveOutput obj_conv;
42920         obj_conv.inner = untag_ptr(obj);
42921         obj_conv.is_owned = ptr_is_owned(obj);
42922         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42923         obj_conv.is_owned = false;
42924         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
42925         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42926         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42927         CVec_u8Z_free(ret_var);
42928         return ret_arr;
42929 }
42930
42931 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
42932         LDKu8slice ser_ref;
42933         ser_ref.datalen = ser->arr_len;
42934         ser_ref.data = ser->elems;
42935         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
42936         *ret_conv = TxRemoveOutput_read(ser_ref);
42937         FREE(ser);
42938         return tag_ptr(ret_conv, true);
42939 }
42940
42941 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
42942         LDKTxComplete obj_conv;
42943         obj_conv.inner = untag_ptr(obj);
42944         obj_conv.is_owned = ptr_is_owned(obj);
42945         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42946         obj_conv.is_owned = false;
42947         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
42948         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42949         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42950         CVec_u8Z_free(ret_var);
42951         return ret_arr;
42952 }
42953
42954 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
42955         LDKu8slice ser_ref;
42956         ser_ref.datalen = ser->arr_len;
42957         ser_ref.data = ser->elems;
42958         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
42959         *ret_conv = TxComplete_read(ser_ref);
42960         FREE(ser);
42961         return tag_ptr(ret_conv, true);
42962 }
42963
42964 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
42965         LDKTxSignatures obj_conv;
42966         obj_conv.inner = untag_ptr(obj);
42967         obj_conv.is_owned = ptr_is_owned(obj);
42968         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42969         obj_conv.is_owned = false;
42970         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
42971         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42972         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42973         CVec_u8Z_free(ret_var);
42974         return ret_arr;
42975 }
42976
42977 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
42978         LDKu8slice ser_ref;
42979         ser_ref.datalen = ser->arr_len;
42980         ser_ref.data = ser->elems;
42981         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
42982         *ret_conv = TxSignatures_read(ser_ref);
42983         FREE(ser);
42984         return tag_ptr(ret_conv, true);
42985 }
42986
42987 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
42988         LDKTxInitRbf obj_conv;
42989         obj_conv.inner = untag_ptr(obj);
42990         obj_conv.is_owned = ptr_is_owned(obj);
42991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42992         obj_conv.is_owned = false;
42993         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
42994         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42995         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42996         CVec_u8Z_free(ret_var);
42997         return ret_arr;
42998 }
42999
43000 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
43001         LDKu8slice ser_ref;
43002         ser_ref.datalen = ser->arr_len;
43003         ser_ref.data = ser->elems;
43004         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
43005         *ret_conv = TxInitRbf_read(ser_ref);
43006         FREE(ser);
43007         return tag_ptr(ret_conv, true);
43008 }
43009
43010 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
43011         LDKTxAckRbf obj_conv;
43012         obj_conv.inner = untag_ptr(obj);
43013         obj_conv.is_owned = ptr_is_owned(obj);
43014         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43015         obj_conv.is_owned = false;
43016         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
43017         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43018         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43019         CVec_u8Z_free(ret_var);
43020         return ret_arr;
43021 }
43022
43023 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
43024         LDKu8slice ser_ref;
43025         ser_ref.datalen = ser->arr_len;
43026         ser_ref.data = ser->elems;
43027         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
43028         *ret_conv = TxAckRbf_read(ser_ref);
43029         FREE(ser);
43030         return tag_ptr(ret_conv, true);
43031 }
43032
43033 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
43034         LDKTxAbort obj_conv;
43035         obj_conv.inner = untag_ptr(obj);
43036         obj_conv.is_owned = ptr_is_owned(obj);
43037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43038         obj_conv.is_owned = false;
43039         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
43040         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43041         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43042         CVec_u8Z_free(ret_var);
43043         return ret_arr;
43044 }
43045
43046 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
43047         LDKu8slice ser_ref;
43048         ser_ref.datalen = ser->arr_len;
43049         ser_ref.data = ser->elems;
43050         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
43051         *ret_conv = TxAbort_read(ser_ref);
43052         FREE(ser);
43053         return tag_ptr(ret_conv, true);
43054 }
43055
43056 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
43057         LDKAnnouncementSignatures obj_conv;
43058         obj_conv.inner = untag_ptr(obj);
43059         obj_conv.is_owned = ptr_is_owned(obj);
43060         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43061         obj_conv.is_owned = false;
43062         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
43063         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43064         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43065         CVec_u8Z_free(ret_var);
43066         return ret_arr;
43067 }
43068
43069 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
43070         LDKu8slice ser_ref;
43071         ser_ref.datalen = ser->arr_len;
43072         ser_ref.data = ser->elems;
43073         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
43074         *ret_conv = AnnouncementSignatures_read(ser_ref);
43075         FREE(ser);
43076         return tag_ptr(ret_conv, true);
43077 }
43078
43079 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
43080         LDKChannelReestablish obj_conv;
43081         obj_conv.inner = untag_ptr(obj);
43082         obj_conv.is_owned = ptr_is_owned(obj);
43083         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43084         obj_conv.is_owned = false;
43085         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
43086         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43087         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43088         CVec_u8Z_free(ret_var);
43089         return ret_arr;
43090 }
43091
43092 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
43093         LDKu8slice ser_ref;
43094         ser_ref.datalen = ser->arr_len;
43095         ser_ref.data = ser->elems;
43096         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
43097         *ret_conv = ChannelReestablish_read(ser_ref);
43098         FREE(ser);
43099         return tag_ptr(ret_conv, true);
43100 }
43101
43102 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
43103         LDKClosingSigned obj_conv;
43104         obj_conv.inner = untag_ptr(obj);
43105         obj_conv.is_owned = ptr_is_owned(obj);
43106         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43107         obj_conv.is_owned = false;
43108         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
43109         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43110         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43111         CVec_u8Z_free(ret_var);
43112         return ret_arr;
43113 }
43114
43115 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
43116         LDKu8slice ser_ref;
43117         ser_ref.datalen = ser->arr_len;
43118         ser_ref.data = ser->elems;
43119         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
43120         *ret_conv = ClosingSigned_read(ser_ref);
43121         FREE(ser);
43122         return tag_ptr(ret_conv, true);
43123 }
43124
43125 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
43126         LDKClosingSignedFeeRange obj_conv;
43127         obj_conv.inner = untag_ptr(obj);
43128         obj_conv.is_owned = ptr_is_owned(obj);
43129         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43130         obj_conv.is_owned = false;
43131         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
43132         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43133         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43134         CVec_u8Z_free(ret_var);
43135         return ret_arr;
43136 }
43137
43138 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
43139         LDKu8slice ser_ref;
43140         ser_ref.datalen = ser->arr_len;
43141         ser_ref.data = ser->elems;
43142         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
43143         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
43144         FREE(ser);
43145         return tag_ptr(ret_conv, true);
43146 }
43147
43148 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
43149         LDKCommitmentSigned obj_conv;
43150         obj_conv.inner = untag_ptr(obj);
43151         obj_conv.is_owned = ptr_is_owned(obj);
43152         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43153         obj_conv.is_owned = false;
43154         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
43155         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43156         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43157         CVec_u8Z_free(ret_var);
43158         return ret_arr;
43159 }
43160
43161 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
43162         LDKu8slice ser_ref;
43163         ser_ref.datalen = ser->arr_len;
43164         ser_ref.data = ser->elems;
43165         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
43166         *ret_conv = CommitmentSigned_read(ser_ref);
43167         FREE(ser);
43168         return tag_ptr(ret_conv, true);
43169 }
43170
43171 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
43172         LDKFundingCreated obj_conv;
43173         obj_conv.inner = untag_ptr(obj);
43174         obj_conv.is_owned = ptr_is_owned(obj);
43175         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43176         obj_conv.is_owned = false;
43177         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
43178         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43179         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43180         CVec_u8Z_free(ret_var);
43181         return ret_arr;
43182 }
43183
43184 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
43185         LDKu8slice ser_ref;
43186         ser_ref.datalen = ser->arr_len;
43187         ser_ref.data = ser->elems;
43188         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
43189         *ret_conv = FundingCreated_read(ser_ref);
43190         FREE(ser);
43191         return tag_ptr(ret_conv, true);
43192 }
43193
43194 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
43195         LDKFundingSigned obj_conv;
43196         obj_conv.inner = untag_ptr(obj);
43197         obj_conv.is_owned = ptr_is_owned(obj);
43198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43199         obj_conv.is_owned = false;
43200         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
43201         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43202         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43203         CVec_u8Z_free(ret_var);
43204         return ret_arr;
43205 }
43206
43207 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
43208         LDKu8slice ser_ref;
43209         ser_ref.datalen = ser->arr_len;
43210         ser_ref.data = ser->elems;
43211         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
43212         *ret_conv = FundingSigned_read(ser_ref);
43213         FREE(ser);
43214         return tag_ptr(ret_conv, true);
43215 }
43216
43217 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
43218         LDKChannelReady obj_conv;
43219         obj_conv.inner = untag_ptr(obj);
43220         obj_conv.is_owned = ptr_is_owned(obj);
43221         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43222         obj_conv.is_owned = false;
43223         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
43224         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43225         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43226         CVec_u8Z_free(ret_var);
43227         return ret_arr;
43228 }
43229
43230 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
43231         LDKu8slice ser_ref;
43232         ser_ref.datalen = ser->arr_len;
43233         ser_ref.data = ser->elems;
43234         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
43235         *ret_conv = ChannelReady_read(ser_ref);
43236         FREE(ser);
43237         return tag_ptr(ret_conv, true);
43238 }
43239
43240 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
43241         LDKInit obj_conv;
43242         obj_conv.inner = untag_ptr(obj);
43243         obj_conv.is_owned = ptr_is_owned(obj);
43244         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43245         obj_conv.is_owned = false;
43246         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
43247         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43248         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43249         CVec_u8Z_free(ret_var);
43250         return ret_arr;
43251 }
43252
43253 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
43254         LDKu8slice ser_ref;
43255         ser_ref.datalen = ser->arr_len;
43256         ser_ref.data = ser->elems;
43257         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
43258         *ret_conv = Init_read(ser_ref);
43259         FREE(ser);
43260         return tag_ptr(ret_conv, true);
43261 }
43262
43263 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
43264         LDKOpenChannel obj_conv;
43265         obj_conv.inner = untag_ptr(obj);
43266         obj_conv.is_owned = ptr_is_owned(obj);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43268         obj_conv.is_owned = false;
43269         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
43270         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43271         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43272         CVec_u8Z_free(ret_var);
43273         return ret_arr;
43274 }
43275
43276 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
43277         LDKu8slice ser_ref;
43278         ser_ref.datalen = ser->arr_len;
43279         ser_ref.data = ser->elems;
43280         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
43281         *ret_conv = OpenChannel_read(ser_ref);
43282         FREE(ser);
43283         return tag_ptr(ret_conv, true);
43284 }
43285
43286 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
43287         LDKOpenChannelV2 obj_conv;
43288         obj_conv.inner = untag_ptr(obj);
43289         obj_conv.is_owned = ptr_is_owned(obj);
43290         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43291         obj_conv.is_owned = false;
43292         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
43293         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43294         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43295         CVec_u8Z_free(ret_var);
43296         return ret_arr;
43297 }
43298
43299 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
43300         LDKu8slice ser_ref;
43301         ser_ref.datalen = ser->arr_len;
43302         ser_ref.data = ser->elems;
43303         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
43304         *ret_conv = OpenChannelV2_read(ser_ref);
43305         FREE(ser);
43306         return tag_ptr(ret_conv, true);
43307 }
43308
43309 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
43310         LDKRevokeAndACK obj_conv;
43311         obj_conv.inner = untag_ptr(obj);
43312         obj_conv.is_owned = ptr_is_owned(obj);
43313         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43314         obj_conv.is_owned = false;
43315         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
43316         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43317         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43318         CVec_u8Z_free(ret_var);
43319         return ret_arr;
43320 }
43321
43322 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
43323         LDKu8slice ser_ref;
43324         ser_ref.datalen = ser->arr_len;
43325         ser_ref.data = ser->elems;
43326         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
43327         *ret_conv = RevokeAndACK_read(ser_ref);
43328         FREE(ser);
43329         return tag_ptr(ret_conv, true);
43330 }
43331
43332 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
43333         LDKShutdown obj_conv;
43334         obj_conv.inner = untag_ptr(obj);
43335         obj_conv.is_owned = ptr_is_owned(obj);
43336         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43337         obj_conv.is_owned = false;
43338         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
43339         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43340         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43341         CVec_u8Z_free(ret_var);
43342         return ret_arr;
43343 }
43344
43345 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
43346         LDKu8slice ser_ref;
43347         ser_ref.datalen = ser->arr_len;
43348         ser_ref.data = ser->elems;
43349         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
43350         *ret_conv = Shutdown_read(ser_ref);
43351         FREE(ser);
43352         return tag_ptr(ret_conv, true);
43353 }
43354
43355 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
43356         LDKUpdateFailHTLC obj_conv;
43357         obj_conv.inner = untag_ptr(obj);
43358         obj_conv.is_owned = ptr_is_owned(obj);
43359         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43360         obj_conv.is_owned = false;
43361         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
43362         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43363         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43364         CVec_u8Z_free(ret_var);
43365         return ret_arr;
43366 }
43367
43368 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
43369         LDKu8slice ser_ref;
43370         ser_ref.datalen = ser->arr_len;
43371         ser_ref.data = ser->elems;
43372         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
43373         *ret_conv = UpdateFailHTLC_read(ser_ref);
43374         FREE(ser);
43375         return tag_ptr(ret_conv, true);
43376 }
43377
43378 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
43379         LDKUpdateFailMalformedHTLC obj_conv;
43380         obj_conv.inner = untag_ptr(obj);
43381         obj_conv.is_owned = ptr_is_owned(obj);
43382         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43383         obj_conv.is_owned = false;
43384         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
43385         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43386         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43387         CVec_u8Z_free(ret_var);
43388         return ret_arr;
43389 }
43390
43391 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
43392         LDKu8slice ser_ref;
43393         ser_ref.datalen = ser->arr_len;
43394         ser_ref.data = ser->elems;
43395         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
43396         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
43397         FREE(ser);
43398         return tag_ptr(ret_conv, true);
43399 }
43400
43401 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
43402         LDKUpdateFee obj_conv;
43403         obj_conv.inner = untag_ptr(obj);
43404         obj_conv.is_owned = ptr_is_owned(obj);
43405         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43406         obj_conv.is_owned = false;
43407         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
43408         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43409         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43410         CVec_u8Z_free(ret_var);
43411         return ret_arr;
43412 }
43413
43414 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
43415         LDKu8slice ser_ref;
43416         ser_ref.datalen = ser->arr_len;
43417         ser_ref.data = ser->elems;
43418         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
43419         *ret_conv = UpdateFee_read(ser_ref);
43420         FREE(ser);
43421         return tag_ptr(ret_conv, true);
43422 }
43423
43424 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
43425         LDKUpdateFulfillHTLC obj_conv;
43426         obj_conv.inner = untag_ptr(obj);
43427         obj_conv.is_owned = ptr_is_owned(obj);
43428         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43429         obj_conv.is_owned = false;
43430         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
43431         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43432         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43433         CVec_u8Z_free(ret_var);
43434         return ret_arr;
43435 }
43436
43437 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
43438         LDKu8slice ser_ref;
43439         ser_ref.datalen = ser->arr_len;
43440         ser_ref.data = ser->elems;
43441         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
43442         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
43443         FREE(ser);
43444         return tag_ptr(ret_conv, true);
43445 }
43446
43447 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
43448         LDKUpdateAddHTLC obj_conv;
43449         obj_conv.inner = untag_ptr(obj);
43450         obj_conv.is_owned = ptr_is_owned(obj);
43451         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43452         obj_conv.is_owned = false;
43453         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
43454         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43455         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43456         CVec_u8Z_free(ret_var);
43457         return ret_arr;
43458 }
43459
43460 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
43461         LDKu8slice ser_ref;
43462         ser_ref.datalen = ser->arr_len;
43463         ser_ref.data = ser->elems;
43464         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
43465         *ret_conv = UpdateAddHTLC_read(ser_ref);
43466         FREE(ser);
43467         return tag_ptr(ret_conv, true);
43468 }
43469
43470 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
43471         LDKu8slice ser_ref;
43472         ser_ref.datalen = ser->arr_len;
43473         ser_ref.data = ser->elems;
43474         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
43475         *ret_conv = OnionMessage_read(ser_ref);
43476         FREE(ser);
43477         return tag_ptr(ret_conv, true);
43478 }
43479
43480 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
43481         LDKOnionMessage obj_conv;
43482         obj_conv.inner = untag_ptr(obj);
43483         obj_conv.is_owned = ptr_is_owned(obj);
43484         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43485         obj_conv.is_owned = false;
43486         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
43487         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43488         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43489         CVec_u8Z_free(ret_var);
43490         return ret_arr;
43491 }
43492
43493 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
43494         LDKPing obj_conv;
43495         obj_conv.inner = untag_ptr(obj);
43496         obj_conv.is_owned = ptr_is_owned(obj);
43497         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43498         obj_conv.is_owned = false;
43499         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
43500         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43501         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43502         CVec_u8Z_free(ret_var);
43503         return ret_arr;
43504 }
43505
43506 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
43507         LDKu8slice ser_ref;
43508         ser_ref.datalen = ser->arr_len;
43509         ser_ref.data = ser->elems;
43510         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
43511         *ret_conv = Ping_read(ser_ref);
43512         FREE(ser);
43513         return tag_ptr(ret_conv, true);
43514 }
43515
43516 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
43517         LDKPong obj_conv;
43518         obj_conv.inner = untag_ptr(obj);
43519         obj_conv.is_owned = ptr_is_owned(obj);
43520         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43521         obj_conv.is_owned = false;
43522         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
43523         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43524         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43525         CVec_u8Z_free(ret_var);
43526         return ret_arr;
43527 }
43528
43529 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
43530         LDKu8slice ser_ref;
43531         ser_ref.datalen = ser->arr_len;
43532         ser_ref.data = ser->elems;
43533         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
43534         *ret_conv = Pong_read(ser_ref);
43535         FREE(ser);
43536         return tag_ptr(ret_conv, true);
43537 }
43538
43539 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
43540         LDKUnsignedChannelAnnouncement obj_conv;
43541         obj_conv.inner = untag_ptr(obj);
43542         obj_conv.is_owned = ptr_is_owned(obj);
43543         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43544         obj_conv.is_owned = false;
43545         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
43546         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43547         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43548         CVec_u8Z_free(ret_var);
43549         return ret_arr;
43550 }
43551
43552 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
43553         LDKu8slice ser_ref;
43554         ser_ref.datalen = ser->arr_len;
43555         ser_ref.data = ser->elems;
43556         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
43557         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
43558         FREE(ser);
43559         return tag_ptr(ret_conv, true);
43560 }
43561
43562 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
43563         LDKChannelAnnouncement obj_conv;
43564         obj_conv.inner = untag_ptr(obj);
43565         obj_conv.is_owned = ptr_is_owned(obj);
43566         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43567         obj_conv.is_owned = false;
43568         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
43569         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43570         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43571         CVec_u8Z_free(ret_var);
43572         return ret_arr;
43573 }
43574
43575 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
43576         LDKu8slice ser_ref;
43577         ser_ref.datalen = ser->arr_len;
43578         ser_ref.data = ser->elems;
43579         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
43580         *ret_conv = ChannelAnnouncement_read(ser_ref);
43581         FREE(ser);
43582         return tag_ptr(ret_conv, true);
43583 }
43584
43585 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
43586         LDKUnsignedChannelUpdate obj_conv;
43587         obj_conv.inner = untag_ptr(obj);
43588         obj_conv.is_owned = ptr_is_owned(obj);
43589         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43590         obj_conv.is_owned = false;
43591         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
43592         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43593         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43594         CVec_u8Z_free(ret_var);
43595         return ret_arr;
43596 }
43597
43598 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
43599         LDKu8slice ser_ref;
43600         ser_ref.datalen = ser->arr_len;
43601         ser_ref.data = ser->elems;
43602         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
43603         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
43604         FREE(ser);
43605         return tag_ptr(ret_conv, true);
43606 }
43607
43608 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
43609         LDKChannelUpdate obj_conv;
43610         obj_conv.inner = untag_ptr(obj);
43611         obj_conv.is_owned = ptr_is_owned(obj);
43612         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43613         obj_conv.is_owned = false;
43614         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
43615         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43616         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43617         CVec_u8Z_free(ret_var);
43618         return ret_arr;
43619 }
43620
43621 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
43622         LDKu8slice ser_ref;
43623         ser_ref.datalen = ser->arr_len;
43624         ser_ref.data = ser->elems;
43625         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
43626         *ret_conv = ChannelUpdate_read(ser_ref);
43627         FREE(ser);
43628         return tag_ptr(ret_conv, true);
43629 }
43630
43631 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
43632         LDKErrorMessage obj_conv;
43633         obj_conv.inner = untag_ptr(obj);
43634         obj_conv.is_owned = ptr_is_owned(obj);
43635         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43636         obj_conv.is_owned = false;
43637         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
43638         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43639         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43640         CVec_u8Z_free(ret_var);
43641         return ret_arr;
43642 }
43643
43644 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
43645         LDKu8slice ser_ref;
43646         ser_ref.datalen = ser->arr_len;
43647         ser_ref.data = ser->elems;
43648         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
43649         *ret_conv = ErrorMessage_read(ser_ref);
43650         FREE(ser);
43651         return tag_ptr(ret_conv, true);
43652 }
43653
43654 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
43655         LDKWarningMessage obj_conv;
43656         obj_conv.inner = untag_ptr(obj);
43657         obj_conv.is_owned = ptr_is_owned(obj);
43658         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43659         obj_conv.is_owned = false;
43660         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
43661         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43662         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43663         CVec_u8Z_free(ret_var);
43664         return ret_arr;
43665 }
43666
43667 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
43668         LDKu8slice ser_ref;
43669         ser_ref.datalen = ser->arr_len;
43670         ser_ref.data = ser->elems;
43671         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
43672         *ret_conv = WarningMessage_read(ser_ref);
43673         FREE(ser);
43674         return tag_ptr(ret_conv, true);
43675 }
43676
43677 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
43678         LDKUnsignedNodeAnnouncement obj_conv;
43679         obj_conv.inner = untag_ptr(obj);
43680         obj_conv.is_owned = ptr_is_owned(obj);
43681         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43682         obj_conv.is_owned = false;
43683         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
43684         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43685         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43686         CVec_u8Z_free(ret_var);
43687         return ret_arr;
43688 }
43689
43690 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
43691         LDKu8slice ser_ref;
43692         ser_ref.datalen = ser->arr_len;
43693         ser_ref.data = ser->elems;
43694         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
43695         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
43696         FREE(ser);
43697         return tag_ptr(ret_conv, true);
43698 }
43699
43700 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
43701         LDKNodeAnnouncement obj_conv;
43702         obj_conv.inner = untag_ptr(obj);
43703         obj_conv.is_owned = ptr_is_owned(obj);
43704         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43705         obj_conv.is_owned = false;
43706         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
43707         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43708         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43709         CVec_u8Z_free(ret_var);
43710         return ret_arr;
43711 }
43712
43713 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
43714         LDKu8slice ser_ref;
43715         ser_ref.datalen = ser->arr_len;
43716         ser_ref.data = ser->elems;
43717         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
43718         *ret_conv = NodeAnnouncement_read(ser_ref);
43719         FREE(ser);
43720         return tag_ptr(ret_conv, true);
43721 }
43722
43723 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
43724         LDKu8slice ser_ref;
43725         ser_ref.datalen = ser->arr_len;
43726         ser_ref.data = ser->elems;
43727         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
43728         *ret_conv = QueryShortChannelIds_read(ser_ref);
43729         FREE(ser);
43730         return tag_ptr(ret_conv, true);
43731 }
43732
43733 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
43734         LDKQueryShortChannelIds obj_conv;
43735         obj_conv.inner = untag_ptr(obj);
43736         obj_conv.is_owned = ptr_is_owned(obj);
43737         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43738         obj_conv.is_owned = false;
43739         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
43740         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43741         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43742         CVec_u8Z_free(ret_var);
43743         return ret_arr;
43744 }
43745
43746 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
43747         LDKReplyShortChannelIdsEnd obj_conv;
43748         obj_conv.inner = untag_ptr(obj);
43749         obj_conv.is_owned = ptr_is_owned(obj);
43750         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43751         obj_conv.is_owned = false;
43752         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
43753         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43754         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43755         CVec_u8Z_free(ret_var);
43756         return ret_arr;
43757 }
43758
43759 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
43760         LDKu8slice ser_ref;
43761         ser_ref.datalen = ser->arr_len;
43762         ser_ref.data = ser->elems;
43763         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
43764         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
43765         FREE(ser);
43766         return tag_ptr(ret_conv, true);
43767 }
43768
43769 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
43770         LDKQueryChannelRange this_arg_conv;
43771         this_arg_conv.inner = untag_ptr(this_arg);
43772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43774         this_arg_conv.is_owned = false;
43775         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
43776         return ret_conv;
43777 }
43778
43779 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
43780         LDKQueryChannelRange obj_conv;
43781         obj_conv.inner = untag_ptr(obj);
43782         obj_conv.is_owned = ptr_is_owned(obj);
43783         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43784         obj_conv.is_owned = false;
43785         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
43786         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43787         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43788         CVec_u8Z_free(ret_var);
43789         return ret_arr;
43790 }
43791
43792 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
43793         LDKu8slice ser_ref;
43794         ser_ref.datalen = ser->arr_len;
43795         ser_ref.data = ser->elems;
43796         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
43797         *ret_conv = QueryChannelRange_read(ser_ref);
43798         FREE(ser);
43799         return tag_ptr(ret_conv, true);
43800 }
43801
43802 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
43803         LDKu8slice ser_ref;
43804         ser_ref.datalen = ser->arr_len;
43805         ser_ref.data = ser->elems;
43806         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
43807         *ret_conv = ReplyChannelRange_read(ser_ref);
43808         FREE(ser);
43809         return tag_ptr(ret_conv, true);
43810 }
43811
43812 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
43813         LDKReplyChannelRange obj_conv;
43814         obj_conv.inner = untag_ptr(obj);
43815         obj_conv.is_owned = ptr_is_owned(obj);
43816         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43817         obj_conv.is_owned = false;
43818         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
43819         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43820         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43821         CVec_u8Z_free(ret_var);
43822         return ret_arr;
43823 }
43824
43825 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
43826         LDKGossipTimestampFilter obj_conv;
43827         obj_conv.inner = untag_ptr(obj);
43828         obj_conv.is_owned = ptr_is_owned(obj);
43829         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43830         obj_conv.is_owned = false;
43831         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
43832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43834         CVec_u8Z_free(ret_var);
43835         return ret_arr;
43836 }
43837
43838 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
43839         LDKu8slice ser_ref;
43840         ser_ref.datalen = ser->arr_len;
43841         ser_ref.data = ser->elems;
43842         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
43843         *ret_conv = GossipTimestampFilter_read(ser_ref);
43844         FREE(ser);
43845         return tag_ptr(ret_conv, true);
43846 }
43847
43848 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
43849         if (!ptr_is_owned(this_ptr)) return;
43850         void* this_ptr_ptr = untag_ptr(this_ptr);
43851         CHECK_ACCESS(this_ptr_ptr);
43852         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
43853         FREE(untag_ptr(this_ptr));
43854         CustomMessageHandler_free(this_ptr_conv);
43855 }
43856
43857 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
43858         LDKIgnoringMessageHandler this_obj_conv;
43859         this_obj_conv.inner = untag_ptr(this_obj);
43860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43862         IgnoringMessageHandler_free(this_obj_conv);
43863 }
43864
43865 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
43866         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
43867         uint64_t ret_ref = 0;
43868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43870         return ret_ref;
43871 }
43872
43873 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
43874         LDKIgnoringMessageHandler this_arg_conv;
43875         this_arg_conv.inner = untag_ptr(this_arg);
43876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43878         this_arg_conv.is_owned = false;
43879         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43880         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
43881         return tag_ptr(ret_ret, true);
43882 }
43883
43884 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
43885         LDKIgnoringMessageHandler this_arg_conv;
43886         this_arg_conv.inner = untag_ptr(this_arg);
43887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43889         this_arg_conv.is_owned = false;
43890         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
43891         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
43892         return tag_ptr(ret_ret, true);
43893 }
43894
43895 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
43896         LDKIgnoringMessageHandler this_arg_conv;
43897         this_arg_conv.inner = untag_ptr(this_arg);
43898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43900         this_arg_conv.is_owned = false;
43901         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
43902         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
43903         return tag_ptr(ret_ret, true);
43904 }
43905
43906 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
43907         LDKIgnoringMessageHandler this_arg_conv;
43908         this_arg_conv.inner = untag_ptr(this_arg);
43909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43911         this_arg_conv.is_owned = false;
43912         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
43913         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
43914         return tag_ptr(ret_ret, true);
43915 }
43916
43917 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
43918         LDKIgnoringMessageHandler this_arg_conv;
43919         this_arg_conv.inner = untag_ptr(this_arg);
43920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43922         this_arg_conv.is_owned = false;
43923         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
43924         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
43925         return tag_ptr(ret_ret, true);
43926 }
43927
43928 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
43929         LDKIgnoringMessageHandler this_arg_conv;
43930         this_arg_conv.inner = untag_ptr(this_arg);
43931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43933         this_arg_conv.is_owned = false;
43934         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
43935         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
43936         return tag_ptr(ret_ret, true);
43937 }
43938
43939 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
43940         LDKIgnoringMessageHandler this_arg_conv;
43941         this_arg_conv.inner = untag_ptr(this_arg);
43942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43944         this_arg_conv.is_owned = false;
43945         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
43946         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
43947         return tag_ptr(ret_ret, true);
43948 }
43949
43950 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
43951         LDKIgnoringMessageHandler this_arg_conv;
43952         this_arg_conv.inner = untag_ptr(this_arg);
43953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43955         this_arg_conv.is_owned = false;
43956         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
43957         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
43958         return tag_ptr(ret_ret, true);
43959 }
43960
43961 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
43962         LDKErroringMessageHandler this_obj_conv;
43963         this_obj_conv.inner = untag_ptr(this_obj);
43964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43966         ErroringMessageHandler_free(this_obj_conv);
43967 }
43968
43969 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
43970         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
43971         uint64_t ret_ref = 0;
43972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43974         return ret_ref;
43975 }
43976
43977 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
43978         LDKErroringMessageHandler this_arg_conv;
43979         this_arg_conv.inner = untag_ptr(this_arg);
43980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43982         this_arg_conv.is_owned = false;
43983         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43984         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
43985         return tag_ptr(ret_ret, true);
43986 }
43987
43988 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
43989         LDKErroringMessageHandler this_arg_conv;
43990         this_arg_conv.inner = untag_ptr(this_arg);
43991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43993         this_arg_conv.is_owned = false;
43994         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
43995         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
43996         return tag_ptr(ret_ret, true);
43997 }
43998
43999 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
44000         LDKMessageHandler this_obj_conv;
44001         this_obj_conv.inner = untag_ptr(this_obj);
44002         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44004         MessageHandler_free(this_obj_conv);
44005 }
44006
44007 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
44008         LDKMessageHandler this_ptr_conv;
44009         this_ptr_conv.inner = untag_ptr(this_ptr);
44010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44012         this_ptr_conv.is_owned = false;
44013         // WARNING: This object doesn't live past this scope, needs clone!
44014         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
44015         return ret_ret;
44016 }
44017
44018 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
44019         LDKMessageHandler this_ptr_conv;
44020         this_ptr_conv.inner = untag_ptr(this_ptr);
44021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44023         this_ptr_conv.is_owned = false;
44024         void* val_ptr = untag_ptr(val);
44025         CHECK_ACCESS(val_ptr);
44026         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
44027         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
44028                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44029                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
44030         }
44031         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
44032 }
44033
44034 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
44035         LDKMessageHandler this_ptr_conv;
44036         this_ptr_conv.inner = untag_ptr(this_ptr);
44037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44039         this_ptr_conv.is_owned = false;
44040         // WARNING: This object doesn't live past this scope, needs clone!
44041         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
44042         return ret_ret;
44043 }
44044
44045 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
44046         LDKMessageHandler this_ptr_conv;
44047         this_ptr_conv.inner = untag_ptr(this_ptr);
44048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44050         this_ptr_conv.is_owned = false;
44051         void* val_ptr = untag_ptr(val);
44052         CHECK_ACCESS(val_ptr);
44053         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
44054         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
44055                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44056                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
44057         }
44058         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
44059 }
44060
44061 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
44062         LDKMessageHandler this_ptr_conv;
44063         this_ptr_conv.inner = untag_ptr(this_ptr);
44064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44066         this_ptr_conv.is_owned = false;
44067         // WARNING: This object doesn't live past this scope, needs clone!
44068         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
44069         return ret_ret;
44070 }
44071
44072 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
44073         LDKMessageHandler this_ptr_conv;
44074         this_ptr_conv.inner = untag_ptr(this_ptr);
44075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44077         this_ptr_conv.is_owned = false;
44078         void* val_ptr = untag_ptr(val);
44079         CHECK_ACCESS(val_ptr);
44080         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
44081         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
44082                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44083                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
44084         }
44085         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
44086 }
44087
44088 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
44089         LDKMessageHandler this_ptr_conv;
44090         this_ptr_conv.inner = untag_ptr(this_ptr);
44091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44093         this_ptr_conv.is_owned = false;
44094         // WARNING: This object doesn't live past this scope, needs clone!
44095         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
44096         return ret_ret;
44097 }
44098
44099 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
44100         LDKMessageHandler this_ptr_conv;
44101         this_ptr_conv.inner = untag_ptr(this_ptr);
44102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44104         this_ptr_conv.is_owned = false;
44105         void* val_ptr = untag_ptr(val);
44106         CHECK_ACCESS(val_ptr);
44107         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
44108         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
44109                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44110                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
44111         }
44112         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
44113 }
44114
44115 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) {
44116         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
44117         CHECK_ACCESS(chan_handler_arg_ptr);
44118         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
44119         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
44120                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44121                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
44122         }
44123         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
44124         CHECK_ACCESS(route_handler_arg_ptr);
44125         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
44126         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
44127                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44128                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
44129         }
44130         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
44131         CHECK_ACCESS(onion_message_handler_arg_ptr);
44132         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
44133         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
44134                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44135                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
44136         }
44137         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
44138         CHECK_ACCESS(custom_message_handler_arg_ptr);
44139         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
44140         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
44141                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44142                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
44143         }
44144         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
44145         uint64_t ret_ref = 0;
44146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44148         return ret_ref;
44149 }
44150
44151 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
44152         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
44153         *ret_ret = SocketDescriptor_clone(arg);
44154         return tag_ptr(ret_ret, true);
44155 }
44156 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
44157         void* arg_ptr = untag_ptr(arg);
44158         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
44159         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
44160         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
44161         return ret_conv;
44162 }
44163
44164 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
44165         void* orig_ptr = untag_ptr(orig);
44166         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
44167         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
44168         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
44169         *ret_ret = SocketDescriptor_clone(orig_conv);
44170         return tag_ptr(ret_ret, true);
44171 }
44172
44173 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
44174         if (!ptr_is_owned(this_ptr)) return;
44175         void* this_ptr_ptr = untag_ptr(this_ptr);
44176         CHECK_ACCESS(this_ptr_ptr);
44177         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
44178         FREE(untag_ptr(this_ptr));
44179         SocketDescriptor_free(this_ptr_conv);
44180 }
44181
44182 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
44183         LDKPeerHandleError this_obj_conv;
44184         this_obj_conv.inner = untag_ptr(this_obj);
44185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44187         PeerHandleError_free(this_obj_conv);
44188 }
44189
44190 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
44191         LDKPeerHandleError ret_var = PeerHandleError_new();
44192         uint64_t ret_ref = 0;
44193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44195         return ret_ref;
44196 }
44197
44198 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
44199         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
44200         uint64_t ret_ref = 0;
44201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44203         return ret_ref;
44204 }
44205 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
44206         LDKPeerHandleError arg_conv;
44207         arg_conv.inner = untag_ptr(arg);
44208         arg_conv.is_owned = ptr_is_owned(arg);
44209         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44210         arg_conv.is_owned = false;
44211         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
44212         return ret_conv;
44213 }
44214
44215 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
44216         LDKPeerHandleError orig_conv;
44217         orig_conv.inner = untag_ptr(orig);
44218         orig_conv.is_owned = ptr_is_owned(orig);
44219         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44220         orig_conv.is_owned = false;
44221         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
44222         uint64_t ret_ref = 0;
44223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44225         return ret_ref;
44226 }
44227
44228 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
44229         LDKPeerManager this_obj_conv;
44230         this_obj_conv.inner = untag_ptr(this_obj);
44231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44233         PeerManager_free(this_obj_conv);
44234 }
44235
44236 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) {
44237         LDKMessageHandler message_handler_conv;
44238         message_handler_conv.inner = untag_ptr(message_handler);
44239         message_handler_conv.is_owned = ptr_is_owned(message_handler);
44240         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
44241         // WARNING: we need a move here but no clone is available for LDKMessageHandler
44242         
44243         uint8_t ephemeral_random_data_arr[32];
44244         CHECK(ephemeral_random_data->arr_len == 32);
44245         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
44246         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
44247         void* logger_ptr = untag_ptr(logger);
44248         CHECK_ACCESS(logger_ptr);
44249         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44250         if (logger_conv.free == LDKLogger_JCalls_free) {
44251                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44252                 LDKLogger_JCalls_cloned(&logger_conv);
44253         }
44254         void* node_signer_ptr = untag_ptr(node_signer);
44255         CHECK_ACCESS(node_signer_ptr);
44256         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
44257         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
44258                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44259                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
44260         }
44261         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
44262         uint64_t ret_ref = 0;
44263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44265         return ret_ref;
44266 }
44267
44268 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
44269         LDKPeerManager this_arg_conv;
44270         this_arg_conv.inner = untag_ptr(this_arg);
44271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44273         this_arg_conv.is_owned = false;
44274         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
44275         uint64_tArray ret_arr = NULL;
44276         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44277         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44278         for (size_t o = 0; o < ret_var.datalen; o++) {
44279                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
44280                 *ret_conv_40_conv = ret_var.data[o];
44281                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
44282         }
44283         
44284         FREE(ret_var.data);
44285         return ret_arr;
44286 }
44287
44288 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) {
44289         LDKPeerManager this_arg_conv;
44290         this_arg_conv.inner = untag_ptr(this_arg);
44291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44293         this_arg_conv.is_owned = false;
44294         LDKPublicKey their_node_id_ref;
44295         CHECK(their_node_id->arr_len == 33);
44296         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
44297         void* descriptor_ptr = untag_ptr(descriptor);
44298         CHECK_ACCESS(descriptor_ptr);
44299         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
44300         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
44301                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44302                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
44303         }
44304         void* remote_network_address_ptr = untag_ptr(remote_network_address);
44305         CHECK_ACCESS(remote_network_address_ptr);
44306         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
44307         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
44308         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
44309         return tag_ptr(ret_conv, true);
44310 }
44311
44312 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) {
44313         LDKPeerManager this_arg_conv;
44314         this_arg_conv.inner = untag_ptr(this_arg);
44315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44317         this_arg_conv.is_owned = false;
44318         void* descriptor_ptr = untag_ptr(descriptor);
44319         CHECK_ACCESS(descriptor_ptr);
44320         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
44321         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
44322                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44323                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
44324         }
44325         void* remote_network_address_ptr = untag_ptr(remote_network_address);
44326         CHECK_ACCESS(remote_network_address_ptr);
44327         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
44328         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
44329         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
44330         return tag_ptr(ret_conv, true);
44331 }
44332
44333 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
44334         LDKPeerManager this_arg_conv;
44335         this_arg_conv.inner = untag_ptr(this_arg);
44336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44338         this_arg_conv.is_owned = false;
44339         void* descriptor_ptr = untag_ptr(descriptor);
44340         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
44341         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
44342         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
44343         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
44344         return tag_ptr(ret_conv, true);
44345 }
44346
44347 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
44348         LDKPeerManager this_arg_conv;
44349         this_arg_conv.inner = untag_ptr(this_arg);
44350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44352         this_arg_conv.is_owned = false;
44353         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
44354         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
44355         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
44356         LDKu8slice data_ref;
44357         data_ref.datalen = data->arr_len;
44358         data_ref.data = data->elems;
44359         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
44360         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
44361         FREE(data);
44362         return tag_ptr(ret_conv, true);
44363 }
44364
44365 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
44366         LDKPeerManager this_arg_conv;
44367         this_arg_conv.inner = untag_ptr(this_arg);
44368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44370         this_arg_conv.is_owned = false;
44371         PeerManager_process_events(&this_arg_conv);
44372 }
44373
44374 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
44375         LDKPeerManager this_arg_conv;
44376         this_arg_conv.inner = untag_ptr(this_arg);
44377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44379         this_arg_conv.is_owned = false;
44380         void* descriptor_ptr = untag_ptr(descriptor);
44381         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
44382         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
44383         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
44384 }
44385
44386 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
44387         LDKPeerManager this_arg_conv;
44388         this_arg_conv.inner = untag_ptr(this_arg);
44389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44391         this_arg_conv.is_owned = false;
44392         LDKPublicKey node_id_ref;
44393         CHECK(node_id->arr_len == 33);
44394         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
44395         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
44396 }
44397
44398 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
44399         LDKPeerManager this_arg_conv;
44400         this_arg_conv.inner = untag_ptr(this_arg);
44401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44403         this_arg_conv.is_owned = false;
44404         PeerManager_disconnect_all_peers(&this_arg_conv);
44405 }
44406
44407 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
44408         LDKPeerManager this_arg_conv;
44409         this_arg_conv.inner = untag_ptr(this_arg);
44410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44412         this_arg_conv.is_owned = false;
44413         PeerManager_timer_tick_occurred(&this_arg_conv);
44414 }
44415
44416 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) {
44417         LDKPeerManager this_arg_conv;
44418         this_arg_conv.inner = untag_ptr(this_arg);
44419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44421         this_arg_conv.is_owned = false;
44422         LDKThreeBytes rgb_ref;
44423         CHECK(rgb->arr_len == 3);
44424         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
44425         LDKThirtyTwoBytes alias_ref;
44426         CHECK(alias->arr_len == 32);
44427         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
44428         LDKCVec_NetAddressZ addresses_constr;
44429         addresses_constr.datalen = addresses->arr_len;
44430         if (addresses_constr.datalen > 0)
44431                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44432         else
44433                 addresses_constr.data = NULL;
44434         uint64_t* addresses_vals = addresses->elems;
44435         for (size_t m = 0; m < addresses_constr.datalen; m++) {
44436                 uint64_t addresses_conv_12 = addresses_vals[m];
44437                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
44438                 CHECK_ACCESS(addresses_conv_12_ptr);
44439                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
44440                 addresses_constr.data[m] = addresses_conv_12_conv;
44441         }
44442         FREE(addresses);
44443         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
44444 }
44445
44446 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
44447         LDKChannelTypeFeatures channel_type_features_conv;
44448         channel_type_features_conv.inner = untag_ptr(channel_type_features);
44449         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
44450         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
44451         channel_type_features_conv.is_owned = false;
44452         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
44453         return ret_conv;
44454 }
44455
44456 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
44457         LDKChannelTypeFeatures channel_type_features_conv;
44458         channel_type_features_conv.inner = untag_ptr(channel_type_features);
44459         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
44460         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
44461         channel_type_features_conv.is_owned = false;
44462         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
44463         return ret_conv;
44464 }
44465
44466 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
44467         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
44468         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
44469         return ret_conv;
44470 }
44471
44472 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
44473         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
44474         return ret_conv;
44475 }
44476
44477 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
44478         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
44479         return ret_conv;
44480 }
44481
44482 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
44483         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
44484         return ret_conv;
44485 }
44486
44487 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
44488         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
44489         return ret_conv;
44490 }
44491
44492 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
44493         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
44494         return ret_conv;
44495 }
44496
44497 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
44498         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
44499         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
44500         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
44501         return ret_conv;
44502 }
44503
44504 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
44505         LDKWitness witness_ref;
44506         witness_ref.datalen = witness->arr_len;
44507         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
44508         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
44509         witness_ref.data_is_owned = true;
44510         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
44511         *ret_copy = HTLCClaim_from_witness(witness_ref);
44512         uint64_t ret_ref = tag_ptr(ret_copy, true);
44513         return ret_ref;
44514 }
44515
44516 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
44517         uint8_t commitment_seed_arr[32];
44518         CHECK(commitment_seed->arr_len == 32);
44519         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
44520         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
44521         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44522         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
44523         return ret_arr;
44524 }
44525
44526 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) {
44527         LDKCVec_u8Z to_holder_script_ref;
44528         to_holder_script_ref.datalen = to_holder_script->arr_len;
44529         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
44530         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
44531         LDKCVec_u8Z to_counterparty_script_ref;
44532         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
44533         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
44534         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
44535         LDKOutPoint funding_outpoint_conv;
44536         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
44537         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
44538         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
44539         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
44540         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);
44541         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44542         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44543         Transaction_free(ret_var);
44544         return ret_arr;
44545 }
44546
44547 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
44548         LDKCounterpartyCommitmentSecrets this_obj_conv;
44549         this_obj_conv.inner = untag_ptr(this_obj);
44550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44552         CounterpartyCommitmentSecrets_free(this_obj_conv);
44553 }
44554
44555 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
44556         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
44557         uint64_t ret_ref = 0;
44558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44560         return ret_ref;
44561 }
44562 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
44563         LDKCounterpartyCommitmentSecrets arg_conv;
44564         arg_conv.inner = untag_ptr(arg);
44565         arg_conv.is_owned = ptr_is_owned(arg);
44566         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44567         arg_conv.is_owned = false;
44568         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
44569         return ret_conv;
44570 }
44571
44572 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
44573         LDKCounterpartyCommitmentSecrets orig_conv;
44574         orig_conv.inner = untag_ptr(orig);
44575         orig_conv.is_owned = ptr_is_owned(orig);
44576         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44577         orig_conv.is_owned = false;
44578         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
44579         uint64_t ret_ref = 0;
44580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44582         return ret_ref;
44583 }
44584
44585 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
44586         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
44587         uint64_t ret_ref = 0;
44588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44590         return ret_ref;
44591 }
44592
44593 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
44594         LDKCounterpartyCommitmentSecrets this_arg_conv;
44595         this_arg_conv.inner = untag_ptr(this_arg);
44596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44598         this_arg_conv.is_owned = false;
44599         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
44600         return ret_conv;
44601 }
44602
44603 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
44604         LDKCounterpartyCommitmentSecrets this_arg_conv;
44605         this_arg_conv.inner = untag_ptr(this_arg);
44606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44608         this_arg_conv.is_owned = false;
44609         LDKThirtyTwoBytes secret_ref;
44610         CHECK(secret->arr_len == 32);
44611         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
44612         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
44613         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
44614         return tag_ptr(ret_conv, true);
44615 }
44616
44617 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
44618         LDKCounterpartyCommitmentSecrets this_arg_conv;
44619         this_arg_conv.inner = untag_ptr(this_arg);
44620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44622         this_arg_conv.is_owned = false;
44623         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44624         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
44625         return ret_arr;
44626 }
44627
44628 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
44629         LDKCounterpartyCommitmentSecrets obj_conv;
44630         obj_conv.inner = untag_ptr(obj);
44631         obj_conv.is_owned = ptr_is_owned(obj);
44632         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44633         obj_conv.is_owned = false;
44634         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
44635         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44636         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44637         CVec_u8Z_free(ret_var);
44638         return ret_arr;
44639 }
44640
44641 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
44642         LDKu8slice ser_ref;
44643         ser_ref.datalen = ser->arr_len;
44644         ser_ref.data = ser->elems;
44645         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
44646         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
44647         FREE(ser);
44648         return tag_ptr(ret_conv, true);
44649 }
44650
44651 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
44652         LDKPublicKey per_commitment_point_ref;
44653         CHECK(per_commitment_point->arr_len == 33);
44654         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44655         uint8_t base_secret_arr[32];
44656         CHECK(base_secret->arr_len == 32);
44657         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
44658         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
44659         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44660         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
44661         return ret_arr;
44662 }
44663
44664 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
44665         LDKPublicKey per_commitment_point_ref;
44666         CHECK(per_commitment_point->arr_len == 33);
44667         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44668         LDKPublicKey base_point_ref;
44669         CHECK(base_point->arr_len == 33);
44670         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
44671         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44672         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
44673         return ret_arr;
44674 }
44675
44676 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) {
44677         uint8_t per_commitment_secret_arr[32];
44678         CHECK(per_commitment_secret->arr_len == 32);
44679         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
44680         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
44681         uint8_t countersignatory_revocation_base_secret_arr[32];
44682         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
44683         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
44684         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
44685         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44686         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
44687         return ret_arr;
44688 }
44689
44690 int8_tArray  __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
44691         LDKPublicKey per_commitment_point_ref;
44692         CHECK(per_commitment_point->arr_len == 33);
44693         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44694         LDKPublicKey countersignatory_revocation_base_point_ref;
44695         CHECK(countersignatory_revocation_base_point->arr_len == 33);
44696         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
44697         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44698         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
44699         return ret_arr;
44700 }
44701
44702 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
44703         LDKTxCreationKeys this_obj_conv;
44704         this_obj_conv.inner = untag_ptr(this_obj);
44705         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44707         TxCreationKeys_free(this_obj_conv);
44708 }
44709
44710 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
44711         LDKTxCreationKeys this_ptr_conv;
44712         this_ptr_conv.inner = untag_ptr(this_ptr);
44713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44715         this_ptr_conv.is_owned = false;
44716         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44717         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
44718         return ret_arr;
44719 }
44720
44721 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
44722         LDKTxCreationKeys this_ptr_conv;
44723         this_ptr_conv.inner = untag_ptr(this_ptr);
44724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44726         this_ptr_conv.is_owned = false;
44727         LDKPublicKey val_ref;
44728         CHECK(val->arr_len == 33);
44729         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44730         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
44731 }
44732
44733 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
44734         LDKTxCreationKeys this_ptr_conv;
44735         this_ptr_conv.inner = untag_ptr(this_ptr);
44736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44738         this_ptr_conv.is_owned = false;
44739         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44740         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
44741         return ret_arr;
44742 }
44743
44744 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
44745         LDKTxCreationKeys this_ptr_conv;
44746         this_ptr_conv.inner = untag_ptr(this_ptr);
44747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44749         this_ptr_conv.is_owned = false;
44750         LDKPublicKey val_ref;
44751         CHECK(val->arr_len == 33);
44752         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44753         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
44754 }
44755
44756 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
44757         LDKTxCreationKeys this_ptr_conv;
44758         this_ptr_conv.inner = untag_ptr(this_ptr);
44759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44761         this_ptr_conv.is_owned = false;
44762         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44763         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
44764         return ret_arr;
44765 }
44766
44767 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
44768         LDKTxCreationKeys this_ptr_conv;
44769         this_ptr_conv.inner = untag_ptr(this_ptr);
44770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44772         this_ptr_conv.is_owned = false;
44773         LDKPublicKey val_ref;
44774         CHECK(val->arr_len == 33);
44775         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44776         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
44777 }
44778
44779 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
44780         LDKTxCreationKeys this_ptr_conv;
44781         this_ptr_conv.inner = untag_ptr(this_ptr);
44782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44784         this_ptr_conv.is_owned = false;
44785         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44786         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
44787         return ret_arr;
44788 }
44789
44790 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
44791         LDKTxCreationKeys this_ptr_conv;
44792         this_ptr_conv.inner = untag_ptr(this_ptr);
44793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44795         this_ptr_conv.is_owned = false;
44796         LDKPublicKey val_ref;
44797         CHECK(val->arr_len == 33);
44798         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44799         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
44800 }
44801
44802 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
44803         LDKTxCreationKeys this_ptr_conv;
44804         this_ptr_conv.inner = untag_ptr(this_ptr);
44805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44807         this_ptr_conv.is_owned = false;
44808         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44809         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
44810         return ret_arr;
44811 }
44812
44813 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint64_t this_ptr, int8_tArray val) {
44814         LDKTxCreationKeys this_ptr_conv;
44815         this_ptr_conv.inner = untag_ptr(this_ptr);
44816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44818         this_ptr_conv.is_owned = false;
44819         LDKPublicKey val_ref;
44820         CHECK(val->arr_len == 33);
44821         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44822         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
44823 }
44824
44825 uint64_t  __attribute__((export_name("TS_TxCreationKeys_new"))) TS_TxCreationKeys_new(int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
44826         LDKPublicKey per_commitment_point_arg_ref;
44827         CHECK(per_commitment_point_arg->arr_len == 33);
44828         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
44829         LDKPublicKey revocation_key_arg_ref;
44830         CHECK(revocation_key_arg->arr_len == 33);
44831         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
44832         LDKPublicKey broadcaster_htlc_key_arg_ref;
44833         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
44834         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
44835         LDKPublicKey countersignatory_htlc_key_arg_ref;
44836         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
44837         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
44838         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
44839         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
44840         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
44841         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
44842         uint64_t ret_ref = 0;
44843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44845         return ret_ref;
44846 }
44847
44848 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
44849         LDKTxCreationKeys a_conv;
44850         a_conv.inner = untag_ptr(a);
44851         a_conv.is_owned = ptr_is_owned(a);
44852         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44853         a_conv.is_owned = false;
44854         LDKTxCreationKeys b_conv;
44855         b_conv.inner = untag_ptr(b);
44856         b_conv.is_owned = ptr_is_owned(b);
44857         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44858         b_conv.is_owned = false;
44859         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
44860         return ret_conv;
44861 }
44862
44863 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
44864         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
44865         uint64_t ret_ref = 0;
44866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44868         return ret_ref;
44869 }
44870 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
44871         LDKTxCreationKeys arg_conv;
44872         arg_conv.inner = untag_ptr(arg);
44873         arg_conv.is_owned = ptr_is_owned(arg);
44874         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44875         arg_conv.is_owned = false;
44876         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
44877         return ret_conv;
44878 }
44879
44880 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
44881         LDKTxCreationKeys orig_conv;
44882         orig_conv.inner = untag_ptr(orig);
44883         orig_conv.is_owned = ptr_is_owned(orig);
44884         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44885         orig_conv.is_owned = false;
44886         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
44887         uint64_t ret_ref = 0;
44888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44890         return ret_ref;
44891 }
44892
44893 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
44894         LDKTxCreationKeys obj_conv;
44895         obj_conv.inner = untag_ptr(obj);
44896         obj_conv.is_owned = ptr_is_owned(obj);
44897         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44898         obj_conv.is_owned = false;
44899         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
44900         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44901         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44902         CVec_u8Z_free(ret_var);
44903         return ret_arr;
44904 }
44905
44906 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
44907         LDKu8slice ser_ref;
44908         ser_ref.datalen = ser->arr_len;
44909         ser_ref.data = ser->elems;
44910         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
44911         *ret_conv = TxCreationKeys_read(ser_ref);
44912         FREE(ser);
44913         return tag_ptr(ret_conv, true);
44914 }
44915
44916 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
44917         LDKChannelPublicKeys this_obj_conv;
44918         this_obj_conv.inner = untag_ptr(this_obj);
44919         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44921         ChannelPublicKeys_free(this_obj_conv);
44922 }
44923
44924 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
44925         LDKChannelPublicKeys this_ptr_conv;
44926         this_ptr_conv.inner = untag_ptr(this_ptr);
44927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44929         this_ptr_conv.is_owned = false;
44930         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44931         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
44932         return ret_arr;
44933 }
44934
44935 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
44936         LDKChannelPublicKeys this_ptr_conv;
44937         this_ptr_conv.inner = untag_ptr(this_ptr);
44938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44940         this_ptr_conv.is_owned = false;
44941         LDKPublicKey val_ref;
44942         CHECK(val->arr_len == 33);
44943         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44944         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
44945 }
44946
44947 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
44948         LDKChannelPublicKeys this_ptr_conv;
44949         this_ptr_conv.inner = untag_ptr(this_ptr);
44950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44952         this_ptr_conv.is_owned = false;
44953         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44954         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
44955         return ret_arr;
44956 }
44957
44958 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
44959         LDKChannelPublicKeys this_ptr_conv;
44960         this_ptr_conv.inner = untag_ptr(this_ptr);
44961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44963         this_ptr_conv.is_owned = false;
44964         LDKPublicKey val_ref;
44965         CHECK(val->arr_len == 33);
44966         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44967         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
44968 }
44969
44970 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
44971         LDKChannelPublicKeys this_ptr_conv;
44972         this_ptr_conv.inner = untag_ptr(this_ptr);
44973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44975         this_ptr_conv.is_owned = false;
44976         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44977         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
44978         return ret_arr;
44979 }
44980
44981 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
44982         LDKChannelPublicKeys this_ptr_conv;
44983         this_ptr_conv.inner = untag_ptr(this_ptr);
44984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44986         this_ptr_conv.is_owned = false;
44987         LDKPublicKey val_ref;
44988         CHECK(val->arr_len == 33);
44989         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44990         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
44991 }
44992
44993 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
44994         LDKChannelPublicKeys this_ptr_conv;
44995         this_ptr_conv.inner = untag_ptr(this_ptr);
44996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44998         this_ptr_conv.is_owned = false;
44999         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45000         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
45001         return ret_arr;
45002 }
45003
45004 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
45005         LDKChannelPublicKeys this_ptr_conv;
45006         this_ptr_conv.inner = untag_ptr(this_ptr);
45007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45009         this_ptr_conv.is_owned = false;
45010         LDKPublicKey val_ref;
45011         CHECK(val->arr_len == 33);
45012         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45013         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
45014 }
45015
45016 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
45017         LDKChannelPublicKeys this_ptr_conv;
45018         this_ptr_conv.inner = untag_ptr(this_ptr);
45019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45021         this_ptr_conv.is_owned = false;
45022         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45023         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
45024         return ret_arr;
45025 }
45026
45027 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
45028         LDKChannelPublicKeys this_ptr_conv;
45029         this_ptr_conv.inner = untag_ptr(this_ptr);
45030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45032         this_ptr_conv.is_owned = false;
45033         LDKPublicKey val_ref;
45034         CHECK(val->arr_len == 33);
45035         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45036         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
45037 }
45038
45039 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_new"))) TS_ChannelPublicKeys_new(int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg) {
45040         LDKPublicKey funding_pubkey_arg_ref;
45041         CHECK(funding_pubkey_arg->arr_len == 33);
45042         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
45043         LDKPublicKey revocation_basepoint_arg_ref;
45044         CHECK(revocation_basepoint_arg->arr_len == 33);
45045         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
45046         LDKPublicKey payment_point_arg_ref;
45047         CHECK(payment_point_arg->arr_len == 33);
45048         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
45049         LDKPublicKey delayed_payment_basepoint_arg_ref;
45050         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
45051         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
45052         LDKPublicKey htlc_basepoint_arg_ref;
45053         CHECK(htlc_basepoint_arg->arr_len == 33);
45054         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
45055         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
45056         uint64_t ret_ref = 0;
45057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45059         return ret_ref;
45060 }
45061
45062 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
45063         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
45064         uint64_t ret_ref = 0;
45065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45067         return ret_ref;
45068 }
45069 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
45070         LDKChannelPublicKeys arg_conv;
45071         arg_conv.inner = untag_ptr(arg);
45072         arg_conv.is_owned = ptr_is_owned(arg);
45073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45074         arg_conv.is_owned = false;
45075         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
45076         return ret_conv;
45077 }
45078
45079 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
45080         LDKChannelPublicKeys orig_conv;
45081         orig_conv.inner = untag_ptr(orig);
45082         orig_conv.is_owned = ptr_is_owned(orig);
45083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45084         orig_conv.is_owned = false;
45085         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
45086         uint64_t ret_ref = 0;
45087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45089         return ret_ref;
45090 }
45091
45092 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
45093         LDKChannelPublicKeys a_conv;
45094         a_conv.inner = untag_ptr(a);
45095         a_conv.is_owned = ptr_is_owned(a);
45096         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45097         a_conv.is_owned = false;
45098         LDKChannelPublicKeys b_conv;
45099         b_conv.inner = untag_ptr(b);
45100         b_conv.is_owned = ptr_is_owned(b);
45101         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45102         b_conv.is_owned = false;
45103         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
45104         return ret_conv;
45105 }
45106
45107 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
45108         LDKChannelPublicKeys obj_conv;
45109         obj_conv.inner = untag_ptr(obj);
45110         obj_conv.is_owned = ptr_is_owned(obj);
45111         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45112         obj_conv.is_owned = false;
45113         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
45114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45116         CVec_u8Z_free(ret_var);
45117         return ret_arr;
45118 }
45119
45120 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
45121         LDKu8slice ser_ref;
45122         ser_ref.datalen = ser->arr_len;
45123         ser_ref.data = ser->elems;
45124         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
45125         *ret_conv = ChannelPublicKeys_read(ser_ref);
45126         FREE(ser);
45127         return tag_ptr(ret_conv, true);
45128 }
45129
45130 uint64_t  __attribute__((export_name("TS_TxCreationKeys_derive_new"))) TS_TxCreationKeys_derive_new(int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
45131         LDKPublicKey per_commitment_point_ref;
45132         CHECK(per_commitment_point->arr_len == 33);
45133         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
45134         LDKPublicKey broadcaster_delayed_payment_base_ref;
45135         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
45136         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
45137         LDKPublicKey broadcaster_htlc_base_ref;
45138         CHECK(broadcaster_htlc_base->arr_len == 33);
45139         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
45140         LDKPublicKey countersignatory_revocation_base_ref;
45141         CHECK(countersignatory_revocation_base->arr_len == 33);
45142         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
45143         LDKPublicKey countersignatory_htlc_base_ref;
45144         CHECK(countersignatory_htlc_base->arr_len == 33);
45145         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
45146         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
45147         uint64_t ret_ref = 0;
45148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45150         return ret_ref;
45151 }
45152
45153 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) {
45154         LDKPublicKey per_commitment_point_ref;
45155         CHECK(per_commitment_point->arr_len == 33);
45156         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
45157         LDKChannelPublicKeys broadcaster_keys_conv;
45158         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
45159         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
45160         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
45161         broadcaster_keys_conv.is_owned = false;
45162         LDKChannelPublicKeys countersignatory_keys_conv;
45163         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
45164         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
45165         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
45166         countersignatory_keys_conv.is_owned = false;
45167         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
45168         uint64_t ret_ref = 0;
45169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45171         return ret_ref;
45172 }
45173
45174 int8_tArray  __attribute__((export_name("TS_get_revokeable_redeemscript"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
45175         LDKPublicKey revocation_key_ref;
45176         CHECK(revocation_key->arr_len == 33);
45177         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
45178         LDKPublicKey broadcaster_delayed_payment_key_ref;
45179         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
45180         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
45181         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
45182         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45183         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45184         CVec_u8Z_free(ret_var);
45185         return ret_arr;
45186 }
45187
45188 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
45189         LDKHTLCOutputInCommitment this_obj_conv;
45190         this_obj_conv.inner = untag_ptr(this_obj);
45191         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45193         HTLCOutputInCommitment_free(this_obj_conv);
45194 }
45195
45196 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
45197         LDKHTLCOutputInCommitment this_ptr_conv;
45198         this_ptr_conv.inner = untag_ptr(this_ptr);
45199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45201         this_ptr_conv.is_owned = false;
45202         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
45203         return ret_conv;
45204 }
45205
45206 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
45207         LDKHTLCOutputInCommitment this_ptr_conv;
45208         this_ptr_conv.inner = untag_ptr(this_ptr);
45209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45211         this_ptr_conv.is_owned = false;
45212         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
45213 }
45214
45215 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
45216         LDKHTLCOutputInCommitment 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         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
45222         return ret_conv;
45223 }
45224
45225 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
45226         LDKHTLCOutputInCommitment this_ptr_conv;
45227         this_ptr_conv.inner = untag_ptr(this_ptr);
45228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45230         this_ptr_conv.is_owned = false;
45231         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
45232 }
45233
45234 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
45235         LDKHTLCOutputInCommitment this_ptr_conv;
45236         this_ptr_conv.inner = untag_ptr(this_ptr);
45237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45239         this_ptr_conv.is_owned = false;
45240         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
45241         return ret_conv;
45242 }
45243
45244 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
45245         LDKHTLCOutputInCommitment this_ptr_conv;
45246         this_ptr_conv.inner = untag_ptr(this_ptr);
45247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45249         this_ptr_conv.is_owned = false;
45250         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
45251 }
45252
45253 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
45254         LDKHTLCOutputInCommitment this_ptr_conv;
45255         this_ptr_conv.inner = untag_ptr(this_ptr);
45256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45258         this_ptr_conv.is_owned = false;
45259         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45260         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
45261         return ret_arr;
45262 }
45263
45264 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
45265         LDKHTLCOutputInCommitment this_ptr_conv;
45266         this_ptr_conv.inner = untag_ptr(this_ptr);
45267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45269         this_ptr_conv.is_owned = false;
45270         LDKThirtyTwoBytes val_ref;
45271         CHECK(val->arr_len == 32);
45272         memcpy(val_ref.data, val->elems, 32); FREE(val);
45273         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
45274 }
45275
45276 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
45277         LDKHTLCOutputInCommitment this_ptr_conv;
45278         this_ptr_conv.inner = untag_ptr(this_ptr);
45279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45281         this_ptr_conv.is_owned = false;
45282         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45283         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
45284         uint64_t ret_ref = tag_ptr(ret_copy, true);
45285         return ret_ref;
45286 }
45287
45288 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
45289         LDKHTLCOutputInCommitment this_ptr_conv;
45290         this_ptr_conv.inner = untag_ptr(this_ptr);
45291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45293         this_ptr_conv.is_owned = false;
45294         void* val_ptr = untag_ptr(val);
45295         CHECK_ACCESS(val_ptr);
45296         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
45297         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
45298         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
45299 }
45300
45301 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) {
45302         LDKThirtyTwoBytes payment_hash_arg_ref;
45303         CHECK(payment_hash_arg->arr_len == 32);
45304         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
45305         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
45306         CHECK_ACCESS(transaction_output_index_arg_ptr);
45307         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
45308         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
45309         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
45310         uint64_t ret_ref = 0;
45311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45313         return ret_ref;
45314 }
45315
45316 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
45317         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
45318         uint64_t ret_ref = 0;
45319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45321         return ret_ref;
45322 }
45323 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
45324         LDKHTLCOutputInCommitment arg_conv;
45325         arg_conv.inner = untag_ptr(arg);
45326         arg_conv.is_owned = ptr_is_owned(arg);
45327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45328         arg_conv.is_owned = false;
45329         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
45330         return ret_conv;
45331 }
45332
45333 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
45334         LDKHTLCOutputInCommitment orig_conv;
45335         orig_conv.inner = untag_ptr(orig);
45336         orig_conv.is_owned = ptr_is_owned(orig);
45337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45338         orig_conv.is_owned = false;
45339         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
45340         uint64_t ret_ref = 0;
45341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45343         return ret_ref;
45344 }
45345
45346 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
45347         LDKHTLCOutputInCommitment a_conv;
45348         a_conv.inner = untag_ptr(a);
45349         a_conv.is_owned = ptr_is_owned(a);
45350         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45351         a_conv.is_owned = false;
45352         LDKHTLCOutputInCommitment b_conv;
45353         b_conv.inner = untag_ptr(b);
45354         b_conv.is_owned = ptr_is_owned(b);
45355         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45356         b_conv.is_owned = false;
45357         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
45358         return ret_conv;
45359 }
45360
45361 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
45362         LDKHTLCOutputInCommitment obj_conv;
45363         obj_conv.inner = untag_ptr(obj);
45364         obj_conv.is_owned = ptr_is_owned(obj);
45365         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45366         obj_conv.is_owned = false;
45367         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
45368         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45369         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45370         CVec_u8Z_free(ret_var);
45371         return ret_arr;
45372 }
45373
45374 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
45375         LDKu8slice ser_ref;
45376         ser_ref.datalen = ser->arr_len;
45377         ser_ref.data = ser->elems;
45378         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
45379         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
45380         FREE(ser);
45381         return tag_ptr(ret_conv, true);
45382 }
45383
45384 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
45385         LDKHTLCOutputInCommitment htlc_conv;
45386         htlc_conv.inner = untag_ptr(htlc);
45387         htlc_conv.is_owned = ptr_is_owned(htlc);
45388         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
45389         htlc_conv.is_owned = false;
45390         LDKChannelTypeFeatures channel_type_features_conv;
45391         channel_type_features_conv.inner = untag_ptr(channel_type_features);
45392         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
45393         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
45394         channel_type_features_conv.is_owned = false;
45395         LDKTxCreationKeys keys_conv;
45396         keys_conv.inner = untag_ptr(keys);
45397         keys_conv.is_owned = ptr_is_owned(keys);
45398         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
45399         keys_conv.is_owned = false;
45400         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
45401         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45402         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45403         CVec_u8Z_free(ret_var);
45404         return ret_arr;
45405 }
45406
45407 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
45408         LDKPublicKey broadcaster_ref;
45409         CHECK(broadcaster->arr_len == 33);
45410         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
45411         LDKPublicKey countersignatory_ref;
45412         CHECK(countersignatory->arr_len == 33);
45413         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
45414         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
45415         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45416         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45417         CVec_u8Z_free(ret_var);
45418         return ret_arr;
45419 }
45420
45421 int8_tArray  __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint64_t htlc, uint64_t channel_type_features, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
45422         uint8_t commitment_txid_arr[32];
45423         CHECK(commitment_txid->arr_len == 32);
45424         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
45425         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
45426         LDKHTLCOutputInCommitment htlc_conv;
45427         htlc_conv.inner = untag_ptr(htlc);
45428         htlc_conv.is_owned = ptr_is_owned(htlc);
45429         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
45430         htlc_conv.is_owned = false;
45431         LDKChannelTypeFeatures channel_type_features_conv;
45432         channel_type_features_conv.inner = untag_ptr(channel_type_features);
45433         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
45434         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
45435         channel_type_features_conv.is_owned = false;
45436         LDKPublicKey broadcaster_delayed_payment_key_ref;
45437         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
45438         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
45439         LDKPublicKey revocation_key_ref;
45440         CHECK(revocation_key->arr_len == 33);
45441         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
45442         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
45443         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45444         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45445         Transaction_free(ret_var);
45446         return ret_arr;
45447 }
45448
45449 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) {
45450         LDKSignature local_sig_ref;
45451         CHECK(local_sig->arr_len == 64);
45452         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
45453         LDKSignature remote_sig_ref;
45454         CHECK(remote_sig->arr_len == 64);
45455         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
45456         void* preimage_ptr = untag_ptr(preimage);
45457         CHECK_ACCESS(preimage_ptr);
45458         LDKCOption_PaymentPreimageZ preimage_conv = *(LDKCOption_PaymentPreimageZ*)(preimage_ptr);
45459         preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(preimage));
45460         LDKu8slice redeem_script_ref;
45461         redeem_script_ref.datalen = redeem_script->arr_len;
45462         redeem_script_ref.data = redeem_script->elems;
45463         LDKChannelTypeFeatures channel_type_features_conv;
45464         channel_type_features_conv.inner = untag_ptr(channel_type_features);
45465         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
45466         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
45467         channel_type_features_conv.is_owned = false;
45468         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
45469         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45470         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45471         Witness_free(ret_var);
45472         FREE(redeem_script);
45473         return ret_arr;
45474 }
45475
45476 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
45477         LDKPublicKey payment_point_ref;
45478         CHECK(payment_point->arr_len == 33);
45479         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
45480         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
45481         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45482         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45483         CVec_u8Z_free(ret_var);
45484         return ret_arr;
45485 }
45486
45487 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
45488         LDKPublicKey funding_pubkey_ref;
45489         CHECK(funding_pubkey->arr_len == 33);
45490         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
45491         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
45492         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45493         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45494         CVec_u8Z_free(ret_var);
45495         return ret_arr;
45496 }
45497
45498 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
45499         LDKPublicKey funding_key_ref;
45500         CHECK(funding_key->arr_len == 33);
45501         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
45502         LDKSignature funding_sig_ref;
45503         CHECK(funding_sig->arr_len == 64);
45504         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
45505         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
45506         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45507         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45508         Witness_free(ret_var);
45509         return ret_arr;
45510 }
45511
45512 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
45513         LDKChannelTransactionParameters this_obj_conv;
45514         this_obj_conv.inner = untag_ptr(this_obj);
45515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45517         ChannelTransactionParameters_free(this_obj_conv);
45518 }
45519
45520 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
45521         LDKChannelTransactionParameters this_ptr_conv;
45522         this_ptr_conv.inner = untag_ptr(this_ptr);
45523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45525         this_ptr_conv.is_owned = false;
45526         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
45527         uint64_t ret_ref = 0;
45528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45530         return ret_ref;
45531 }
45532
45533 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
45534         LDKChannelTransactionParameters this_ptr_conv;
45535         this_ptr_conv.inner = untag_ptr(this_ptr);
45536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45538         this_ptr_conv.is_owned = false;
45539         LDKChannelPublicKeys val_conv;
45540         val_conv.inner = untag_ptr(val);
45541         val_conv.is_owned = ptr_is_owned(val);
45542         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45543         val_conv = ChannelPublicKeys_clone(&val_conv);
45544         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
45545 }
45546
45547 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
45548         LDKChannelTransactionParameters this_ptr_conv;
45549         this_ptr_conv.inner = untag_ptr(this_ptr);
45550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45552         this_ptr_conv.is_owned = false;
45553         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
45554         return ret_conv;
45555 }
45556
45557 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) {
45558         LDKChannelTransactionParameters this_ptr_conv;
45559         this_ptr_conv.inner = untag_ptr(this_ptr);
45560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45562         this_ptr_conv.is_owned = false;
45563         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
45564 }
45565
45566 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
45567         LDKChannelTransactionParameters this_ptr_conv;
45568         this_ptr_conv.inner = untag_ptr(this_ptr);
45569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45571         this_ptr_conv.is_owned = false;
45572         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
45573         return ret_conv;
45574 }
45575
45576 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
45577         LDKChannelTransactionParameters this_ptr_conv;
45578         this_ptr_conv.inner = untag_ptr(this_ptr);
45579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45581         this_ptr_conv.is_owned = false;
45582         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
45583 }
45584
45585 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
45586         LDKChannelTransactionParameters this_ptr_conv;
45587         this_ptr_conv.inner = untag_ptr(this_ptr);
45588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45590         this_ptr_conv.is_owned = false;
45591         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
45592         uint64_t ret_ref = 0;
45593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45595         return ret_ref;
45596 }
45597
45598 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
45599         LDKChannelTransactionParameters this_ptr_conv;
45600         this_ptr_conv.inner = untag_ptr(this_ptr);
45601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45603         this_ptr_conv.is_owned = false;
45604         LDKCounterpartyChannelTransactionParameters val_conv;
45605         val_conv.inner = untag_ptr(val);
45606         val_conv.is_owned = ptr_is_owned(val);
45607         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45608         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
45609         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
45610 }
45611
45612 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
45613         LDKChannelTransactionParameters this_ptr_conv;
45614         this_ptr_conv.inner = untag_ptr(this_ptr);
45615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45617         this_ptr_conv.is_owned = false;
45618         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
45619         uint64_t ret_ref = 0;
45620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45622         return ret_ref;
45623 }
45624
45625 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
45626         LDKChannelTransactionParameters this_ptr_conv;
45627         this_ptr_conv.inner = untag_ptr(this_ptr);
45628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45630         this_ptr_conv.is_owned = false;
45631         LDKOutPoint val_conv;
45632         val_conv.inner = untag_ptr(val);
45633         val_conv.is_owned = ptr_is_owned(val);
45634         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45635         val_conv = OutPoint_clone(&val_conv);
45636         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
45637 }
45638
45639 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
45640         LDKChannelTransactionParameters this_ptr_conv;
45641         this_ptr_conv.inner = untag_ptr(this_ptr);
45642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45644         this_ptr_conv.is_owned = false;
45645         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
45646         uint64_t ret_ref = 0;
45647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45649         return ret_ref;
45650 }
45651
45652 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
45653         LDKChannelTransactionParameters this_ptr_conv;
45654         this_ptr_conv.inner = untag_ptr(this_ptr);
45655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45657         this_ptr_conv.is_owned = false;
45658         LDKChannelTypeFeatures val_conv;
45659         val_conv.inner = untag_ptr(val);
45660         val_conv.is_owned = ptr_is_owned(val);
45661         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45662         val_conv = ChannelTypeFeatures_clone(&val_conv);
45663         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
45664 }
45665
45666 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) {
45667         LDKChannelPublicKeys holder_pubkeys_arg_conv;
45668         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
45669         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
45670         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
45671         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
45672         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
45673         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
45674         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
45675         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
45676         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
45677         LDKOutPoint funding_outpoint_arg_conv;
45678         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
45679         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
45680         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
45681         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
45682         LDKChannelTypeFeatures channel_type_features_arg_conv;
45683         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
45684         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
45685         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
45686         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
45687         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);
45688         uint64_t ret_ref = 0;
45689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45691         return ret_ref;
45692 }
45693
45694 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
45695         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
45696         uint64_t ret_ref = 0;
45697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45699         return ret_ref;
45700 }
45701 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
45702         LDKChannelTransactionParameters arg_conv;
45703         arg_conv.inner = untag_ptr(arg);
45704         arg_conv.is_owned = ptr_is_owned(arg);
45705         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45706         arg_conv.is_owned = false;
45707         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
45708         return ret_conv;
45709 }
45710
45711 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
45712         LDKChannelTransactionParameters orig_conv;
45713         orig_conv.inner = untag_ptr(orig);
45714         orig_conv.is_owned = ptr_is_owned(orig);
45715         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45716         orig_conv.is_owned = false;
45717         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
45718         uint64_t ret_ref = 0;
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45721         return ret_ref;
45722 }
45723
45724 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
45725         LDKChannelTransactionParameters a_conv;
45726         a_conv.inner = untag_ptr(a);
45727         a_conv.is_owned = ptr_is_owned(a);
45728         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45729         a_conv.is_owned = false;
45730         LDKChannelTransactionParameters b_conv;
45731         b_conv.inner = untag_ptr(b);
45732         b_conv.is_owned = ptr_is_owned(b);
45733         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45734         b_conv.is_owned = false;
45735         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
45736         return ret_conv;
45737 }
45738
45739 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
45740         LDKCounterpartyChannelTransactionParameters this_obj_conv;
45741         this_obj_conv.inner = untag_ptr(this_obj);
45742         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45744         CounterpartyChannelTransactionParameters_free(this_obj_conv);
45745 }
45746
45747 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
45748         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
45749         this_ptr_conv.inner = untag_ptr(this_ptr);
45750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45752         this_ptr_conv.is_owned = false;
45753         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
45754         uint64_t ret_ref = 0;
45755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45757         return ret_ref;
45758 }
45759
45760 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
45761         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
45762         this_ptr_conv.inner = untag_ptr(this_ptr);
45763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45765         this_ptr_conv.is_owned = false;
45766         LDKChannelPublicKeys val_conv;
45767         val_conv.inner = untag_ptr(val);
45768         val_conv.is_owned = ptr_is_owned(val);
45769         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45770         val_conv = ChannelPublicKeys_clone(&val_conv);
45771         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
45772 }
45773
45774 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
45775         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
45776         this_ptr_conv.inner = untag_ptr(this_ptr);
45777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45779         this_ptr_conv.is_owned = false;
45780         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
45781         return ret_conv;
45782 }
45783
45784 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
45785         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
45786         this_ptr_conv.inner = untag_ptr(this_ptr);
45787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45789         this_ptr_conv.is_owned = false;
45790         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
45791 }
45792
45793 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
45794         LDKChannelPublicKeys pubkeys_arg_conv;
45795         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
45796         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
45797         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
45798         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
45799         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
45800         uint64_t ret_ref = 0;
45801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45803         return ret_ref;
45804 }
45805
45806 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
45807         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
45808         uint64_t ret_ref = 0;
45809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45811         return ret_ref;
45812 }
45813 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
45814         LDKCounterpartyChannelTransactionParameters arg_conv;
45815         arg_conv.inner = untag_ptr(arg);
45816         arg_conv.is_owned = ptr_is_owned(arg);
45817         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45818         arg_conv.is_owned = false;
45819         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
45820         return ret_conv;
45821 }
45822
45823 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
45824         LDKCounterpartyChannelTransactionParameters orig_conv;
45825         orig_conv.inner = untag_ptr(orig);
45826         orig_conv.is_owned = ptr_is_owned(orig);
45827         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45828         orig_conv.is_owned = false;
45829         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
45830         uint64_t ret_ref = 0;
45831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45833         return ret_ref;
45834 }
45835
45836 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
45837         LDKCounterpartyChannelTransactionParameters a_conv;
45838         a_conv.inner = untag_ptr(a);
45839         a_conv.is_owned = ptr_is_owned(a);
45840         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45841         a_conv.is_owned = false;
45842         LDKCounterpartyChannelTransactionParameters b_conv;
45843         b_conv.inner = untag_ptr(b);
45844         b_conv.is_owned = ptr_is_owned(b);
45845         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45846         b_conv.is_owned = false;
45847         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
45848         return ret_conv;
45849 }
45850
45851 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
45852         LDKChannelTransactionParameters this_arg_conv;
45853         this_arg_conv.inner = untag_ptr(this_arg);
45854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45856         this_arg_conv.is_owned = false;
45857         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
45858         return ret_conv;
45859 }
45860
45861 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
45862         LDKChannelTransactionParameters this_arg_conv;
45863         this_arg_conv.inner = untag_ptr(this_arg);
45864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45866         this_arg_conv.is_owned = false;
45867         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
45868         uint64_t ret_ref = 0;
45869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45871         return ret_ref;
45872 }
45873
45874 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
45875         LDKChannelTransactionParameters this_arg_conv;
45876         this_arg_conv.inner = untag_ptr(this_arg);
45877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45879         this_arg_conv.is_owned = false;
45880         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
45881         uint64_t ret_ref = 0;
45882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45884         return ret_ref;
45885 }
45886
45887 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
45888         LDKCounterpartyChannelTransactionParameters obj_conv;
45889         obj_conv.inner = untag_ptr(obj);
45890         obj_conv.is_owned = ptr_is_owned(obj);
45891         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45892         obj_conv.is_owned = false;
45893         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
45894         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45895         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45896         CVec_u8Z_free(ret_var);
45897         return ret_arr;
45898 }
45899
45900 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
45901         LDKu8slice ser_ref;
45902         ser_ref.datalen = ser->arr_len;
45903         ser_ref.data = ser->elems;
45904         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
45905         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
45906         FREE(ser);
45907         return tag_ptr(ret_conv, true);
45908 }
45909
45910 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
45911         LDKChannelTransactionParameters obj_conv;
45912         obj_conv.inner = untag_ptr(obj);
45913         obj_conv.is_owned = ptr_is_owned(obj);
45914         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45915         obj_conv.is_owned = false;
45916         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
45917         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45918         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45919         CVec_u8Z_free(ret_var);
45920         return ret_arr;
45921 }
45922
45923 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
45924         LDKu8slice ser_ref;
45925         ser_ref.datalen = ser->arr_len;
45926         ser_ref.data = ser->elems;
45927         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
45928         *ret_conv = ChannelTransactionParameters_read(ser_ref);
45929         FREE(ser);
45930         return tag_ptr(ret_conv, true);
45931 }
45932
45933 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
45934         LDKDirectedChannelTransactionParameters this_obj_conv;
45935         this_obj_conv.inner = untag_ptr(this_obj);
45936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45938         DirectedChannelTransactionParameters_free(this_obj_conv);
45939 }
45940
45941 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
45942         LDKDirectedChannelTransactionParameters this_arg_conv;
45943         this_arg_conv.inner = untag_ptr(this_arg);
45944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45946         this_arg_conv.is_owned = false;
45947         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
45948         uint64_t ret_ref = 0;
45949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45951         return ret_ref;
45952 }
45953
45954 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
45955         LDKDirectedChannelTransactionParameters this_arg_conv;
45956         this_arg_conv.inner = untag_ptr(this_arg);
45957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45959         this_arg_conv.is_owned = false;
45960         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
45961         uint64_t ret_ref = 0;
45962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45964         return ret_ref;
45965 }
45966
45967 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
45968         LDKDirectedChannelTransactionParameters this_arg_conv;
45969         this_arg_conv.inner = untag_ptr(this_arg);
45970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45972         this_arg_conv.is_owned = false;
45973         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
45974         return ret_conv;
45975 }
45976
45977 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
45978         LDKDirectedChannelTransactionParameters this_arg_conv;
45979         this_arg_conv.inner = untag_ptr(this_arg);
45980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45982         this_arg_conv.is_owned = false;
45983         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
45984         return ret_conv;
45985 }
45986
45987 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
45988         LDKDirectedChannelTransactionParameters this_arg_conv;
45989         this_arg_conv.inner = untag_ptr(this_arg);
45990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45992         this_arg_conv.is_owned = false;
45993         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
45994         uint64_t ret_ref = 0;
45995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45997         return ret_ref;
45998 }
45999
46000 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
46001         LDKDirectedChannelTransactionParameters this_arg_conv;
46002         this_arg_conv.inner = untag_ptr(this_arg);
46003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46005         this_arg_conv.is_owned = false;
46006         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
46007         uint64_t ret_ref = 0;
46008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46010         return ret_ref;
46011 }
46012
46013 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
46014         LDKHolderCommitmentTransaction this_obj_conv;
46015         this_obj_conv.inner = untag_ptr(this_obj);
46016         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46018         HolderCommitmentTransaction_free(this_obj_conv);
46019 }
46020
46021 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
46022         LDKHolderCommitmentTransaction 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         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46028         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
46029         return ret_arr;
46030 }
46031
46032 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
46033         LDKHolderCommitmentTransaction this_ptr_conv;
46034         this_ptr_conv.inner = untag_ptr(this_ptr);
46035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46037         this_ptr_conv.is_owned = false;
46038         LDKSignature val_ref;
46039         CHECK(val->arr_len == 64);
46040         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
46041         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
46042 }
46043
46044 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
46045         LDKHolderCommitmentTransaction this_ptr_conv;
46046         this_ptr_conv.inner = untag_ptr(this_ptr);
46047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46049         this_ptr_conv.is_owned = false;
46050         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
46051         ptrArray ret_arr = NULL;
46052         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
46053         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
46054         for (size_t m = 0; m < ret_var.datalen; m++) {
46055                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
46056                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
46057                 ret_arr_ptr[m] = ret_conv_12_arr;
46058         }
46059         
46060         FREE(ret_var.data);
46061         return ret_arr;
46062 }
46063
46064 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
46065         LDKHolderCommitmentTransaction this_ptr_conv;
46066         this_ptr_conv.inner = untag_ptr(this_ptr);
46067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46069         this_ptr_conv.is_owned = false;
46070         LDKCVec_SignatureZ val_constr;
46071         val_constr.datalen = val->arr_len;
46072         if (val_constr.datalen > 0)
46073                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
46074         else
46075                 val_constr.data = NULL;
46076         int8_tArray* val_vals = (void*) val->elems;
46077         for (size_t m = 0; m < val_constr.datalen; m++) {
46078                 int8_tArray val_conv_12 = val_vals[m];
46079                 LDKSignature val_conv_12_ref;
46080                 CHECK(val_conv_12->arr_len == 64);
46081                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
46082                 val_constr.data[m] = val_conv_12_ref;
46083         }
46084         FREE(val);
46085         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
46086 }
46087
46088 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
46089         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
46090         uint64_t ret_ref = 0;
46091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46093         return ret_ref;
46094 }
46095 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
46096         LDKHolderCommitmentTransaction arg_conv;
46097         arg_conv.inner = untag_ptr(arg);
46098         arg_conv.is_owned = ptr_is_owned(arg);
46099         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46100         arg_conv.is_owned = false;
46101         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
46102         return ret_conv;
46103 }
46104
46105 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
46106         LDKHolderCommitmentTransaction orig_conv;
46107         orig_conv.inner = untag_ptr(orig);
46108         orig_conv.is_owned = ptr_is_owned(orig);
46109         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46110         orig_conv.is_owned = false;
46111         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
46112         uint64_t ret_ref = 0;
46113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46115         return ret_ref;
46116 }
46117
46118 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
46119         LDKHolderCommitmentTransaction obj_conv;
46120         obj_conv.inner = untag_ptr(obj);
46121         obj_conv.is_owned = ptr_is_owned(obj);
46122         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46123         obj_conv.is_owned = false;
46124         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
46125         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46126         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46127         CVec_u8Z_free(ret_var);
46128         return ret_arr;
46129 }
46130
46131 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
46132         LDKu8slice ser_ref;
46133         ser_ref.datalen = ser->arr_len;
46134         ser_ref.data = ser->elems;
46135         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
46136         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
46137         FREE(ser);
46138         return tag_ptr(ret_conv, true);
46139 }
46140
46141 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) {
46142         LDKCommitmentTransaction commitment_tx_conv;
46143         commitment_tx_conv.inner = untag_ptr(commitment_tx);
46144         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
46145         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
46146         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
46147         LDKSignature counterparty_sig_ref;
46148         CHECK(counterparty_sig->arr_len == 64);
46149         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
46150         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
46151         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
46152         if (counterparty_htlc_sigs_constr.datalen > 0)
46153                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
46154         else
46155                 counterparty_htlc_sigs_constr.data = NULL;
46156         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
46157         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
46158                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
46159                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
46160                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
46161                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
46162                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
46163         }
46164         FREE(counterparty_htlc_sigs);
46165         LDKPublicKey holder_funding_key_ref;
46166         CHECK(holder_funding_key->arr_len == 33);
46167         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
46168         LDKPublicKey counterparty_funding_key_ref;
46169         CHECK(counterparty_funding_key->arr_len == 33);
46170         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
46171         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
46172         uint64_t ret_ref = 0;
46173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46175         return ret_ref;
46176 }
46177
46178 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
46179         LDKBuiltCommitmentTransaction this_obj_conv;
46180         this_obj_conv.inner = untag_ptr(this_obj);
46181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46183         BuiltCommitmentTransaction_free(this_obj_conv);
46184 }
46185
46186 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
46187         LDKBuiltCommitmentTransaction this_ptr_conv;
46188         this_ptr_conv.inner = untag_ptr(this_ptr);
46189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46191         this_ptr_conv.is_owned = false;
46192         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
46193         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46194         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46195         Transaction_free(ret_var);
46196         return ret_arr;
46197 }
46198
46199 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
46200         LDKBuiltCommitmentTransaction this_ptr_conv;
46201         this_ptr_conv.inner = untag_ptr(this_ptr);
46202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46204         this_ptr_conv.is_owned = false;
46205         LDKTransaction val_ref;
46206         val_ref.datalen = val->arr_len;
46207         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
46208         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
46209         val_ref.data_is_owned = true;
46210         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
46211 }
46212
46213 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
46214         LDKBuiltCommitmentTransaction this_ptr_conv;
46215         this_ptr_conv.inner = untag_ptr(this_ptr);
46216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46218         this_ptr_conv.is_owned = false;
46219         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46220         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
46221         return ret_arr;
46222 }
46223
46224 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
46225         LDKBuiltCommitmentTransaction this_ptr_conv;
46226         this_ptr_conv.inner = untag_ptr(this_ptr);
46227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46229         this_ptr_conv.is_owned = false;
46230         LDKThirtyTwoBytes val_ref;
46231         CHECK(val->arr_len == 32);
46232         memcpy(val_ref.data, val->elems, 32); FREE(val);
46233         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
46234 }
46235
46236 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
46237         LDKTransaction transaction_arg_ref;
46238         transaction_arg_ref.datalen = transaction_arg->arr_len;
46239         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
46240         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
46241         transaction_arg_ref.data_is_owned = true;
46242         LDKThirtyTwoBytes txid_arg_ref;
46243         CHECK(txid_arg->arr_len == 32);
46244         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
46245         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
46246         uint64_t ret_ref = 0;
46247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46249         return ret_ref;
46250 }
46251
46252 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
46253         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
46254         uint64_t ret_ref = 0;
46255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46257         return ret_ref;
46258 }
46259 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
46260         LDKBuiltCommitmentTransaction arg_conv;
46261         arg_conv.inner = untag_ptr(arg);
46262         arg_conv.is_owned = ptr_is_owned(arg);
46263         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46264         arg_conv.is_owned = false;
46265         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
46266         return ret_conv;
46267 }
46268
46269 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
46270         LDKBuiltCommitmentTransaction orig_conv;
46271         orig_conv.inner = untag_ptr(orig);
46272         orig_conv.is_owned = ptr_is_owned(orig);
46273         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46274         orig_conv.is_owned = false;
46275         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
46276         uint64_t ret_ref = 0;
46277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46279         return ret_ref;
46280 }
46281
46282 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
46283         LDKBuiltCommitmentTransaction obj_conv;
46284         obj_conv.inner = untag_ptr(obj);
46285         obj_conv.is_owned = ptr_is_owned(obj);
46286         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46287         obj_conv.is_owned = false;
46288         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
46289         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46290         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46291         CVec_u8Z_free(ret_var);
46292         return ret_arr;
46293 }
46294
46295 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
46296         LDKu8slice ser_ref;
46297         ser_ref.datalen = ser->arr_len;
46298         ser_ref.data = ser->elems;
46299         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
46300         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
46301         FREE(ser);
46302         return tag_ptr(ret_conv, true);
46303 }
46304
46305 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) {
46306         LDKBuiltCommitmentTransaction this_arg_conv;
46307         this_arg_conv.inner = untag_ptr(this_arg);
46308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46310         this_arg_conv.is_owned = false;
46311         LDKu8slice funding_redeemscript_ref;
46312         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46313         funding_redeemscript_ref.data = funding_redeemscript->elems;
46314         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46315         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
46316         FREE(funding_redeemscript);
46317         return ret_arr;
46318 }
46319
46320 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) {
46321         LDKBuiltCommitmentTransaction this_arg_conv;
46322         this_arg_conv.inner = untag_ptr(this_arg);
46323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46325         this_arg_conv.is_owned = false;
46326         uint8_t funding_key_arr[32];
46327         CHECK(funding_key->arr_len == 32);
46328         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
46329         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
46330         LDKu8slice funding_redeemscript_ref;
46331         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46332         funding_redeemscript_ref.data = funding_redeemscript->elems;
46333         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46334         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
46335         FREE(funding_redeemscript);
46336         return ret_arr;
46337 }
46338
46339 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) {
46340         LDKBuiltCommitmentTransaction this_arg_conv;
46341         this_arg_conv.inner = untag_ptr(this_arg);
46342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46344         this_arg_conv.is_owned = false;
46345         uint8_t funding_key_arr[32];
46346         CHECK(funding_key->arr_len == 32);
46347         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
46348         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
46349         LDKu8slice funding_redeemscript_ref;
46350         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46351         funding_redeemscript_ref.data = funding_redeemscript->elems;
46352         void* entropy_source_ptr = untag_ptr(entropy_source);
46353         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
46354         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
46355         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46356         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);
46357         FREE(funding_redeemscript);
46358         return ret_arr;
46359 }
46360
46361 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
46362         LDKClosingTransaction this_obj_conv;
46363         this_obj_conv.inner = untag_ptr(this_obj);
46364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46366         ClosingTransaction_free(this_obj_conv);
46367 }
46368
46369 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
46370         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
46371         uint64_t ret_ref = 0;
46372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46374         return ret_ref;
46375 }
46376 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
46377         LDKClosingTransaction arg_conv;
46378         arg_conv.inner = untag_ptr(arg);
46379         arg_conv.is_owned = ptr_is_owned(arg);
46380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46381         arg_conv.is_owned = false;
46382         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
46383         return ret_conv;
46384 }
46385
46386 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
46387         LDKClosingTransaction orig_conv;
46388         orig_conv.inner = untag_ptr(orig);
46389         orig_conv.is_owned = ptr_is_owned(orig);
46390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46391         orig_conv.is_owned = false;
46392         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
46393         uint64_t ret_ref = 0;
46394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46396         return ret_ref;
46397 }
46398
46399 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
46400         LDKClosingTransaction o_conv;
46401         o_conv.inner = untag_ptr(o);
46402         o_conv.is_owned = ptr_is_owned(o);
46403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46404         o_conv.is_owned = false;
46405         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
46406         return ret_conv;
46407 }
46408
46409 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
46410         LDKClosingTransaction a_conv;
46411         a_conv.inner = untag_ptr(a);
46412         a_conv.is_owned = ptr_is_owned(a);
46413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46414         a_conv.is_owned = false;
46415         LDKClosingTransaction b_conv;
46416         b_conv.inner = untag_ptr(b);
46417         b_conv.is_owned = ptr_is_owned(b);
46418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46419         b_conv.is_owned = false;
46420         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
46421         return ret_conv;
46422 }
46423
46424 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) {
46425         LDKCVec_u8Z to_holder_script_ref;
46426         to_holder_script_ref.datalen = to_holder_script->arr_len;
46427         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
46428         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
46429         LDKCVec_u8Z to_counterparty_script_ref;
46430         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
46431         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
46432         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
46433         LDKOutPoint funding_outpoint_conv;
46434         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
46435         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
46436         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
46437         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
46438         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
46439         uint64_t ret_ref = 0;
46440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46442         return ret_ref;
46443 }
46444
46445 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
46446         LDKClosingTransaction this_arg_conv;
46447         this_arg_conv.inner = untag_ptr(this_arg);
46448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46450         this_arg_conv.is_owned = false;
46451         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
46452         uint64_t ret_ref = 0;
46453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46455         return ret_ref;
46456 }
46457
46458 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
46459         LDKClosingTransaction this_arg_conv;
46460         this_arg_conv.inner = untag_ptr(this_arg);
46461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46463         this_arg_conv.is_owned = false;
46464         LDKOutPoint funding_outpoint_conv;
46465         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
46466         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
46467         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
46468         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
46469         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
46470         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
46471         return tag_ptr(ret_conv, true);
46472 }
46473
46474 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
46475         LDKClosingTransaction this_arg_conv;
46476         this_arg_conv.inner = untag_ptr(this_arg);
46477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46479         this_arg_conv.is_owned = false;
46480         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
46481         return ret_conv;
46482 }
46483
46484 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
46485         LDKClosingTransaction this_arg_conv;
46486         this_arg_conv.inner = untag_ptr(this_arg);
46487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46489         this_arg_conv.is_owned = false;
46490         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
46491         return ret_conv;
46492 }
46493
46494 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
46495         LDKClosingTransaction this_arg_conv;
46496         this_arg_conv.inner = untag_ptr(this_arg);
46497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46499         this_arg_conv.is_owned = false;
46500         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
46501         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46502         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46503         return ret_arr;
46504 }
46505
46506 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
46507         LDKClosingTransaction this_arg_conv;
46508         this_arg_conv.inner = untag_ptr(this_arg);
46509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46511         this_arg_conv.is_owned = false;
46512         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
46513         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46514         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46515         return ret_arr;
46516 }
46517
46518 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
46519         LDKTrustedClosingTransaction this_obj_conv;
46520         this_obj_conv.inner = untag_ptr(this_obj);
46521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46523         TrustedClosingTransaction_free(this_obj_conv);
46524 }
46525
46526 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
46527         LDKTrustedClosingTransaction this_arg_conv;
46528         this_arg_conv.inner = untag_ptr(this_arg);
46529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46531         this_arg_conv.is_owned = false;
46532         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
46533         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46534         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46535         Transaction_free(ret_var);
46536         return ret_arr;
46537 }
46538
46539 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) {
46540         LDKTrustedClosingTransaction this_arg_conv;
46541         this_arg_conv.inner = untag_ptr(this_arg);
46542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46544         this_arg_conv.is_owned = false;
46545         LDKu8slice funding_redeemscript_ref;
46546         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46547         funding_redeemscript_ref.data = funding_redeemscript->elems;
46548         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46549         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
46550         FREE(funding_redeemscript);
46551         return ret_arr;
46552 }
46553
46554 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) {
46555         LDKTrustedClosingTransaction this_arg_conv;
46556         this_arg_conv.inner = untag_ptr(this_arg);
46557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46559         this_arg_conv.is_owned = false;
46560         uint8_t funding_key_arr[32];
46561         CHECK(funding_key->arr_len == 32);
46562         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
46563         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
46564         LDKu8slice funding_redeemscript_ref;
46565         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46566         funding_redeemscript_ref.data = funding_redeemscript->elems;
46567         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46568         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
46569         FREE(funding_redeemscript);
46570         return ret_arr;
46571 }
46572
46573 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
46574         LDKCommitmentTransaction this_obj_conv;
46575         this_obj_conv.inner = untag_ptr(this_obj);
46576         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46578         CommitmentTransaction_free(this_obj_conv);
46579 }
46580
46581 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
46582         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
46583         uint64_t ret_ref = 0;
46584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46586         return ret_ref;
46587 }
46588 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
46589         LDKCommitmentTransaction arg_conv;
46590         arg_conv.inner = untag_ptr(arg);
46591         arg_conv.is_owned = ptr_is_owned(arg);
46592         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46593         arg_conv.is_owned = false;
46594         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
46595         return ret_conv;
46596 }
46597
46598 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
46599         LDKCommitmentTransaction orig_conv;
46600         orig_conv.inner = untag_ptr(orig);
46601         orig_conv.is_owned = ptr_is_owned(orig);
46602         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46603         orig_conv.is_owned = false;
46604         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
46605         uint64_t ret_ref = 0;
46606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46608         return ret_ref;
46609 }
46610
46611 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
46612         LDKCommitmentTransaction obj_conv;
46613         obj_conv.inner = untag_ptr(obj);
46614         obj_conv.is_owned = ptr_is_owned(obj);
46615         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46616         obj_conv.is_owned = false;
46617         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
46618         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46619         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46620         CVec_u8Z_free(ret_var);
46621         return ret_arr;
46622 }
46623
46624 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
46625         LDKu8slice ser_ref;
46626         ser_ref.datalen = ser->arr_len;
46627         ser_ref.data = ser->elems;
46628         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
46629         *ret_conv = CommitmentTransaction_read(ser_ref);
46630         FREE(ser);
46631         return tag_ptr(ret_conv, true);
46632 }
46633
46634 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
46635         LDKCommitmentTransaction this_arg_conv;
46636         this_arg_conv.inner = untag_ptr(this_arg);
46637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46639         this_arg_conv.is_owned = false;
46640         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
46641         return ret_conv;
46642 }
46643
46644 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
46645         LDKCommitmentTransaction this_arg_conv;
46646         this_arg_conv.inner = untag_ptr(this_arg);
46647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46649         this_arg_conv.is_owned = false;
46650         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
46651         return ret_conv;
46652 }
46653
46654 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
46655         LDKCommitmentTransaction this_arg_conv;
46656         this_arg_conv.inner = untag_ptr(this_arg);
46657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46659         this_arg_conv.is_owned = false;
46660         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
46661         return ret_conv;
46662 }
46663
46664 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
46665         LDKCommitmentTransaction this_arg_conv;
46666         this_arg_conv.inner = untag_ptr(this_arg);
46667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46669         this_arg_conv.is_owned = false;
46670         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
46671         return ret_conv;
46672 }
46673
46674 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
46675         LDKCommitmentTransaction this_arg_conv;
46676         this_arg_conv.inner = untag_ptr(this_arg);
46677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46679         this_arg_conv.is_owned = false;
46680         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
46681         uint64_t ret_ref = 0;
46682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46684         return ret_ref;
46685 }
46686
46687 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) {
46688         LDKCommitmentTransaction this_arg_conv;
46689         this_arg_conv.inner = untag_ptr(this_arg);
46690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46692         this_arg_conv.is_owned = false;
46693         LDKDirectedChannelTransactionParameters channel_parameters_conv;
46694         channel_parameters_conv.inner = untag_ptr(channel_parameters);
46695         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
46696         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
46697         channel_parameters_conv.is_owned = false;
46698         LDKChannelPublicKeys broadcaster_keys_conv;
46699         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
46700         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
46701         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
46702         broadcaster_keys_conv.is_owned = false;
46703         LDKChannelPublicKeys countersignatory_keys_conv;
46704         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
46705         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
46706         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
46707         countersignatory_keys_conv.is_owned = false;
46708         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
46709         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
46710         return tag_ptr(ret_conv, true);
46711 }
46712
46713 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
46714         LDKTrustedCommitmentTransaction this_obj_conv;
46715         this_obj_conv.inner = untag_ptr(this_obj);
46716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46718         TrustedCommitmentTransaction_free(this_obj_conv);
46719 }
46720
46721 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
46722         LDKTrustedCommitmentTransaction this_arg_conv;
46723         this_arg_conv.inner = untag_ptr(this_arg);
46724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46726         this_arg_conv.is_owned = false;
46727         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46728         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
46729         return ret_arr;
46730 }
46731
46732 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
46733         LDKTrustedCommitmentTransaction this_arg_conv;
46734         this_arg_conv.inner = untag_ptr(this_arg);
46735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46737         this_arg_conv.is_owned = false;
46738         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
46739         uint64_t ret_ref = 0;
46740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46742         return ret_ref;
46743 }
46744
46745 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
46746         LDKTrustedCommitmentTransaction this_arg_conv;
46747         this_arg_conv.inner = untag_ptr(this_arg);
46748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46750         this_arg_conv.is_owned = false;
46751         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
46752         uint64_t ret_ref = 0;
46753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46755         return ret_ref;
46756 }
46757
46758 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
46759         LDKTrustedCommitmentTransaction this_arg_conv;
46760         this_arg_conv.inner = untag_ptr(this_arg);
46761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46763         this_arg_conv.is_owned = false;
46764         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
46765         uint64_t ret_ref = 0;
46766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46768         return ret_ref;
46769 }
46770
46771 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) {
46772         LDKTrustedCommitmentTransaction this_arg_conv;
46773         this_arg_conv.inner = untag_ptr(this_arg);
46774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46776         this_arg_conv.is_owned = false;
46777         uint8_t htlc_base_key_arr[32];
46778         CHECK(htlc_base_key->arr_len == 32);
46779         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
46780         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
46781         LDKDirectedChannelTransactionParameters channel_parameters_conv;
46782         channel_parameters_conv.inner = untag_ptr(channel_parameters);
46783         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
46784         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
46785         channel_parameters_conv.is_owned = false;
46786         void* entropy_source_ptr = untag_ptr(entropy_source);
46787         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
46788         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
46789         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
46790         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
46791         return tag_ptr(ret_conv, true);
46792 }
46793
46794 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) {
46795         LDKPublicKey broadcaster_payment_basepoint_ref;
46796         CHECK(broadcaster_payment_basepoint->arr_len == 33);
46797         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
46798         LDKPublicKey countersignatory_payment_basepoint_ref;
46799         CHECK(countersignatory_payment_basepoint->arr_len == 33);
46800         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
46801         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
46802         return ret_conv;
46803 }
46804
46805 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
46806         LDKInitFeatures a_conv;
46807         a_conv.inner = untag_ptr(a);
46808         a_conv.is_owned = ptr_is_owned(a);
46809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46810         a_conv.is_owned = false;
46811         LDKInitFeatures b_conv;
46812         b_conv.inner = untag_ptr(b);
46813         b_conv.is_owned = ptr_is_owned(b);
46814         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46815         b_conv.is_owned = false;
46816         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
46817         return ret_conv;
46818 }
46819
46820 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
46821         LDKNodeFeatures a_conv;
46822         a_conv.inner = untag_ptr(a);
46823         a_conv.is_owned = ptr_is_owned(a);
46824         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46825         a_conv.is_owned = false;
46826         LDKNodeFeatures b_conv;
46827         b_conv.inner = untag_ptr(b);
46828         b_conv.is_owned = ptr_is_owned(b);
46829         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46830         b_conv.is_owned = false;
46831         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
46832         return ret_conv;
46833 }
46834
46835 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
46836         LDKChannelFeatures a_conv;
46837         a_conv.inner = untag_ptr(a);
46838         a_conv.is_owned = ptr_is_owned(a);
46839         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46840         a_conv.is_owned = false;
46841         LDKChannelFeatures b_conv;
46842         b_conv.inner = untag_ptr(b);
46843         b_conv.is_owned = ptr_is_owned(b);
46844         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46845         b_conv.is_owned = false;
46846         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
46847         return ret_conv;
46848 }
46849
46850 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
46851         LDKBolt11InvoiceFeatures a_conv;
46852         a_conv.inner = untag_ptr(a);
46853         a_conv.is_owned = ptr_is_owned(a);
46854         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46855         a_conv.is_owned = false;
46856         LDKBolt11InvoiceFeatures b_conv;
46857         b_conv.inner = untag_ptr(b);
46858         b_conv.is_owned = ptr_is_owned(b);
46859         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46860         b_conv.is_owned = false;
46861         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
46862         return ret_conv;
46863 }
46864
46865 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
46866         LDKOfferFeatures a_conv;
46867         a_conv.inner = untag_ptr(a);
46868         a_conv.is_owned = ptr_is_owned(a);
46869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46870         a_conv.is_owned = false;
46871         LDKOfferFeatures b_conv;
46872         b_conv.inner = untag_ptr(b);
46873         b_conv.is_owned = ptr_is_owned(b);
46874         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46875         b_conv.is_owned = false;
46876         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
46877         return ret_conv;
46878 }
46879
46880 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
46881         LDKInvoiceRequestFeatures a_conv;
46882         a_conv.inner = untag_ptr(a);
46883         a_conv.is_owned = ptr_is_owned(a);
46884         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46885         a_conv.is_owned = false;
46886         LDKInvoiceRequestFeatures b_conv;
46887         b_conv.inner = untag_ptr(b);
46888         b_conv.is_owned = ptr_is_owned(b);
46889         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46890         b_conv.is_owned = false;
46891         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
46892         return ret_conv;
46893 }
46894
46895 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
46896         LDKBolt12InvoiceFeatures 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         LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
46907         return ret_conv;
46908 }
46909
46910 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
46911         LDKBlindedHopFeatures a_conv;
46912         a_conv.inner = untag_ptr(a);
46913         a_conv.is_owned = ptr_is_owned(a);
46914         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46915         a_conv.is_owned = false;
46916         LDKBlindedHopFeatures b_conv;
46917         b_conv.inner = untag_ptr(b);
46918         b_conv.is_owned = ptr_is_owned(b);
46919         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46920         b_conv.is_owned = false;
46921         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
46922         return ret_conv;
46923 }
46924
46925 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
46926         LDKChannelTypeFeatures a_conv;
46927         a_conv.inner = untag_ptr(a);
46928         a_conv.is_owned = ptr_is_owned(a);
46929         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46930         a_conv.is_owned = false;
46931         LDKChannelTypeFeatures b_conv;
46932         b_conv.inner = untag_ptr(b);
46933         b_conv.is_owned = ptr_is_owned(b);
46934         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46935         b_conv.is_owned = false;
46936         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
46937         return ret_conv;
46938 }
46939
46940 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
46941         LDKInitFeatures ret_var = InitFeatures_clone(arg);
46942         uint64_t ret_ref = 0;
46943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46945         return ret_ref;
46946 }
46947 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
46948         LDKInitFeatures arg_conv;
46949         arg_conv.inner = untag_ptr(arg);
46950         arg_conv.is_owned = ptr_is_owned(arg);
46951         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46952         arg_conv.is_owned = false;
46953         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
46954         return ret_conv;
46955 }
46956
46957 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
46958         LDKInitFeatures orig_conv;
46959         orig_conv.inner = untag_ptr(orig);
46960         orig_conv.is_owned = ptr_is_owned(orig);
46961         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46962         orig_conv.is_owned = false;
46963         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
46964         uint64_t ret_ref = 0;
46965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46967         return ret_ref;
46968 }
46969
46970 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
46971         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
46972         uint64_t ret_ref = 0;
46973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46975         return ret_ref;
46976 }
46977 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
46978         LDKNodeFeatures arg_conv;
46979         arg_conv.inner = untag_ptr(arg);
46980         arg_conv.is_owned = ptr_is_owned(arg);
46981         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46982         arg_conv.is_owned = false;
46983         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
46984         return ret_conv;
46985 }
46986
46987 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
46988         LDKNodeFeatures orig_conv;
46989         orig_conv.inner = untag_ptr(orig);
46990         orig_conv.is_owned = ptr_is_owned(orig);
46991         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46992         orig_conv.is_owned = false;
46993         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
46994         uint64_t ret_ref = 0;
46995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46997         return ret_ref;
46998 }
46999
47000 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
47001         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
47002         uint64_t ret_ref = 0;
47003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47005         return ret_ref;
47006 }
47007 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
47008         LDKChannelFeatures arg_conv;
47009         arg_conv.inner = untag_ptr(arg);
47010         arg_conv.is_owned = ptr_is_owned(arg);
47011         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47012         arg_conv.is_owned = false;
47013         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
47014         return ret_conv;
47015 }
47016
47017 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
47018         LDKChannelFeatures orig_conv;
47019         orig_conv.inner = untag_ptr(orig);
47020         orig_conv.is_owned = ptr_is_owned(orig);
47021         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47022         orig_conv.is_owned = false;
47023         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
47024         uint64_t ret_ref = 0;
47025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47027         return ret_ref;
47028 }
47029
47030 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
47031         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
47032         uint64_t ret_ref = 0;
47033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47035         return ret_ref;
47036 }
47037 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
47038         LDKBolt11InvoiceFeatures arg_conv;
47039         arg_conv.inner = untag_ptr(arg);
47040         arg_conv.is_owned = ptr_is_owned(arg);
47041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47042         arg_conv.is_owned = false;
47043         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
47044         return ret_conv;
47045 }
47046
47047 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
47048         LDKBolt11InvoiceFeatures orig_conv;
47049         orig_conv.inner = untag_ptr(orig);
47050         orig_conv.is_owned = ptr_is_owned(orig);
47051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47052         orig_conv.is_owned = false;
47053         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
47054         uint64_t ret_ref = 0;
47055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47057         return ret_ref;
47058 }
47059
47060 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
47061         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
47062         uint64_t ret_ref = 0;
47063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47065         return ret_ref;
47066 }
47067 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
47068         LDKOfferFeatures arg_conv;
47069         arg_conv.inner = untag_ptr(arg);
47070         arg_conv.is_owned = ptr_is_owned(arg);
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47072         arg_conv.is_owned = false;
47073         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
47074         return ret_conv;
47075 }
47076
47077 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
47078         LDKOfferFeatures orig_conv;
47079         orig_conv.inner = untag_ptr(orig);
47080         orig_conv.is_owned = ptr_is_owned(orig);
47081         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47082         orig_conv.is_owned = false;
47083         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
47084         uint64_t ret_ref = 0;
47085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47087         return ret_ref;
47088 }
47089
47090 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
47091         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
47092         uint64_t ret_ref = 0;
47093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47095         return ret_ref;
47096 }
47097 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
47098         LDKInvoiceRequestFeatures arg_conv;
47099         arg_conv.inner = untag_ptr(arg);
47100         arg_conv.is_owned = ptr_is_owned(arg);
47101         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47102         arg_conv.is_owned = false;
47103         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
47104         return ret_conv;
47105 }
47106
47107 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
47108         LDKInvoiceRequestFeatures orig_conv;
47109         orig_conv.inner = untag_ptr(orig);
47110         orig_conv.is_owned = ptr_is_owned(orig);
47111         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47112         orig_conv.is_owned = false;
47113         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
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 Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
47121         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_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_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
47128         LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
47134         return ret_conv;
47135 }
47136
47137 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
47138         LDKBolt12InvoiceFeatures 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         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_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 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
47151         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
47152         uint64_t ret_ref = 0;
47153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47155         return ret_ref;
47156 }
47157 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
47158         LDKBlindedHopFeatures arg_conv;
47159         arg_conv.inner = untag_ptr(arg);
47160         arg_conv.is_owned = ptr_is_owned(arg);
47161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47162         arg_conv.is_owned = false;
47163         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
47164         return ret_conv;
47165 }
47166
47167 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
47168         LDKBlindedHopFeatures orig_conv;
47169         orig_conv.inner = untag_ptr(orig);
47170         orig_conv.is_owned = ptr_is_owned(orig);
47171         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47172         orig_conv.is_owned = false;
47173         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
47174         uint64_t ret_ref = 0;
47175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47177         return ret_ref;
47178 }
47179
47180 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
47181         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
47182         uint64_t ret_ref = 0;
47183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47185         return ret_ref;
47186 }
47187 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
47188         LDKChannelTypeFeatures arg_conv;
47189         arg_conv.inner = untag_ptr(arg);
47190         arg_conv.is_owned = ptr_is_owned(arg);
47191         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47192         arg_conv.is_owned = false;
47193         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
47194         return ret_conv;
47195 }
47196
47197 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
47198         LDKChannelTypeFeatures orig_conv;
47199         orig_conv.inner = untag_ptr(orig);
47200         orig_conv.is_owned = ptr_is_owned(orig);
47201         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47202         orig_conv.is_owned = false;
47203         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
47204         uint64_t ret_ref = 0;
47205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47207         return ret_ref;
47208 }
47209
47210 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
47211         LDKInitFeatures this_obj_conv;
47212         this_obj_conv.inner = untag_ptr(this_obj);
47213         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47215         InitFeatures_free(this_obj_conv);
47216 }
47217
47218 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
47219         LDKNodeFeatures this_obj_conv;
47220         this_obj_conv.inner = untag_ptr(this_obj);
47221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47223         NodeFeatures_free(this_obj_conv);
47224 }
47225
47226 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
47227         LDKChannelFeatures this_obj_conv;
47228         this_obj_conv.inner = untag_ptr(this_obj);
47229         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47231         ChannelFeatures_free(this_obj_conv);
47232 }
47233
47234 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
47235         LDKBolt11InvoiceFeatures this_obj_conv;
47236         this_obj_conv.inner = untag_ptr(this_obj);
47237         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47239         Bolt11InvoiceFeatures_free(this_obj_conv);
47240 }
47241
47242 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
47243         LDKOfferFeatures this_obj_conv;
47244         this_obj_conv.inner = untag_ptr(this_obj);
47245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47247         OfferFeatures_free(this_obj_conv);
47248 }
47249
47250 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
47251         LDKInvoiceRequestFeatures this_obj_conv;
47252         this_obj_conv.inner = untag_ptr(this_obj);
47253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47255         InvoiceRequestFeatures_free(this_obj_conv);
47256 }
47257
47258 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
47259         LDKBolt12InvoiceFeatures this_obj_conv;
47260         this_obj_conv.inner = untag_ptr(this_obj);
47261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47263         Bolt12InvoiceFeatures_free(this_obj_conv);
47264 }
47265
47266 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
47267         LDKBlindedHopFeatures this_obj_conv;
47268         this_obj_conv.inner = untag_ptr(this_obj);
47269         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47271         BlindedHopFeatures_free(this_obj_conv);
47272 }
47273
47274 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
47275         LDKChannelTypeFeatures this_obj_conv;
47276         this_obj_conv.inner = untag_ptr(this_obj);
47277         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47279         ChannelTypeFeatures_free(this_obj_conv);
47280 }
47281
47282 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
47283         LDKInitFeatures ret_var = InitFeatures_empty();
47284         uint64_t ret_ref = 0;
47285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47287         return ret_ref;
47288 }
47289
47290 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47291         LDKInitFeatures this_arg_conv;
47292         this_arg_conv.inner = untag_ptr(this_arg);
47293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47295         this_arg_conv.is_owned = false;
47296         LDKInitFeatures other_conv;
47297         other_conv.inner = untag_ptr(other);
47298         other_conv.is_owned = ptr_is_owned(other);
47299         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47300         other_conv.is_owned = false;
47301         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47302         return ret_conv;
47303 }
47304
47305 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
47306         LDKInitFeatures this_arg_conv;
47307         this_arg_conv.inner = untag_ptr(this_arg);
47308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47310         this_arg_conv.is_owned = false;
47311         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
47312         return ret_conv;
47313 }
47314
47315 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47316         LDKInitFeatures this_arg_conv;
47317         this_arg_conv.inner = untag_ptr(this_arg);
47318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47320         this_arg_conv.is_owned = false;
47321         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47322         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
47323         return tag_ptr(ret_conv, true);
47324 }
47325
47326 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47327         LDKInitFeatures this_arg_conv;
47328         this_arg_conv.inner = untag_ptr(this_arg);
47329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47331         this_arg_conv.is_owned = false;
47332         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47333         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47334         return tag_ptr(ret_conv, true);
47335 }
47336
47337 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
47338         LDKNodeFeatures ret_var = NodeFeatures_empty();
47339         uint64_t ret_ref = 0;
47340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47342         return ret_ref;
47343 }
47344
47345 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47346         LDKNodeFeatures this_arg_conv;
47347         this_arg_conv.inner = untag_ptr(this_arg);
47348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47350         this_arg_conv.is_owned = false;
47351         LDKNodeFeatures other_conv;
47352         other_conv.inner = untag_ptr(other);
47353         other_conv.is_owned = ptr_is_owned(other);
47354         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47355         other_conv.is_owned = false;
47356         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47357         return ret_conv;
47358 }
47359
47360 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
47361         LDKNodeFeatures this_arg_conv;
47362         this_arg_conv.inner = untag_ptr(this_arg);
47363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47365         this_arg_conv.is_owned = false;
47366         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
47367         return ret_conv;
47368 }
47369
47370 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47371         LDKNodeFeatures this_arg_conv;
47372         this_arg_conv.inner = untag_ptr(this_arg);
47373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47375         this_arg_conv.is_owned = false;
47376         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47377         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
47378         return tag_ptr(ret_conv, true);
47379 }
47380
47381 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47382         LDKNodeFeatures this_arg_conv;
47383         this_arg_conv.inner = untag_ptr(this_arg);
47384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47386         this_arg_conv.is_owned = false;
47387         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47388         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47389         return tag_ptr(ret_conv, true);
47390 }
47391
47392 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
47393         LDKChannelFeatures ret_var = ChannelFeatures_empty();
47394         uint64_t ret_ref = 0;
47395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47397         return ret_ref;
47398 }
47399
47400 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47401         LDKChannelFeatures this_arg_conv;
47402         this_arg_conv.inner = untag_ptr(this_arg);
47403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47405         this_arg_conv.is_owned = false;
47406         LDKChannelFeatures other_conv;
47407         other_conv.inner = untag_ptr(other);
47408         other_conv.is_owned = ptr_is_owned(other);
47409         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47410         other_conv.is_owned = false;
47411         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47412         return ret_conv;
47413 }
47414
47415 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
47416         LDKChannelFeatures this_arg_conv;
47417         this_arg_conv.inner = untag_ptr(this_arg);
47418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47420         this_arg_conv.is_owned = false;
47421         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
47422         return ret_conv;
47423 }
47424
47425 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47426         LDKChannelFeatures this_arg_conv;
47427         this_arg_conv.inner = untag_ptr(this_arg);
47428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47430         this_arg_conv.is_owned = false;
47431         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47432         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
47433         return tag_ptr(ret_conv, true);
47434 }
47435
47436 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47437         LDKChannelFeatures this_arg_conv;
47438         this_arg_conv.inner = untag_ptr(this_arg);
47439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47441         this_arg_conv.is_owned = false;
47442         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47443         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47444         return tag_ptr(ret_conv, true);
47445 }
47446
47447 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
47448         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
47449         uint64_t ret_ref = 0;
47450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47452         return ret_ref;
47453 }
47454
47455 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47456         LDKBolt11InvoiceFeatures this_arg_conv;
47457         this_arg_conv.inner = untag_ptr(this_arg);
47458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47460         this_arg_conv.is_owned = false;
47461         LDKBolt11InvoiceFeatures other_conv;
47462         other_conv.inner = untag_ptr(other);
47463         other_conv.is_owned = ptr_is_owned(other);
47464         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47465         other_conv.is_owned = false;
47466         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47467         return ret_conv;
47468 }
47469
47470 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
47471         LDKBolt11InvoiceFeatures this_arg_conv;
47472         this_arg_conv.inner = untag_ptr(this_arg);
47473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47475         this_arg_conv.is_owned = false;
47476         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
47477         return ret_conv;
47478 }
47479
47480 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47481         LDKBolt11InvoiceFeatures this_arg_conv;
47482         this_arg_conv.inner = untag_ptr(this_arg);
47483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47485         this_arg_conv.is_owned = false;
47486         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47487         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
47488         return tag_ptr(ret_conv, true);
47489 }
47490
47491 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47492         LDKBolt11InvoiceFeatures this_arg_conv;
47493         this_arg_conv.inner = untag_ptr(this_arg);
47494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47496         this_arg_conv.is_owned = false;
47497         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47498         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47499         return tag_ptr(ret_conv, true);
47500 }
47501
47502 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
47503         LDKOfferFeatures ret_var = OfferFeatures_empty();
47504         uint64_t ret_ref = 0;
47505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47507         return ret_ref;
47508 }
47509
47510 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47511         LDKOfferFeatures this_arg_conv;
47512         this_arg_conv.inner = untag_ptr(this_arg);
47513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47515         this_arg_conv.is_owned = false;
47516         LDKOfferFeatures other_conv;
47517         other_conv.inner = untag_ptr(other);
47518         other_conv.is_owned = ptr_is_owned(other);
47519         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47520         other_conv.is_owned = false;
47521         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47522         return ret_conv;
47523 }
47524
47525 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
47526         LDKOfferFeatures this_arg_conv;
47527         this_arg_conv.inner = untag_ptr(this_arg);
47528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47530         this_arg_conv.is_owned = false;
47531         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
47532         return ret_conv;
47533 }
47534
47535 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47536         LDKOfferFeatures this_arg_conv;
47537         this_arg_conv.inner = untag_ptr(this_arg);
47538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47540         this_arg_conv.is_owned = false;
47541         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47542         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
47543         return tag_ptr(ret_conv, true);
47544 }
47545
47546 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47547         LDKOfferFeatures this_arg_conv;
47548         this_arg_conv.inner = untag_ptr(this_arg);
47549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47551         this_arg_conv.is_owned = false;
47552         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47553         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47554         return tag_ptr(ret_conv, true);
47555 }
47556
47557 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
47558         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
47559         uint64_t ret_ref = 0;
47560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47562         return ret_ref;
47563 }
47564
47565 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47566         LDKInvoiceRequestFeatures this_arg_conv;
47567         this_arg_conv.inner = untag_ptr(this_arg);
47568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47570         this_arg_conv.is_owned = false;
47571         LDKInvoiceRequestFeatures other_conv;
47572         other_conv.inner = untag_ptr(other);
47573         other_conv.is_owned = ptr_is_owned(other);
47574         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47575         other_conv.is_owned = false;
47576         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47577         return ret_conv;
47578 }
47579
47580 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
47581         LDKInvoiceRequestFeatures this_arg_conv;
47582         this_arg_conv.inner = untag_ptr(this_arg);
47583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47585         this_arg_conv.is_owned = false;
47586         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
47587         return ret_conv;
47588 }
47589
47590 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47591         LDKInvoiceRequestFeatures this_arg_conv;
47592         this_arg_conv.inner = untag_ptr(this_arg);
47593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47595         this_arg_conv.is_owned = false;
47596         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47597         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
47598         return tag_ptr(ret_conv, true);
47599 }
47600
47601 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47602         LDKInvoiceRequestFeatures this_arg_conv;
47603         this_arg_conv.inner = untag_ptr(this_arg);
47604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47606         this_arg_conv.is_owned = false;
47607         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47608         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47609         return tag_ptr(ret_conv, true);
47610 }
47611
47612 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
47613         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
47614         uint64_t ret_ref = 0;
47615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47617         return ret_ref;
47618 }
47619
47620 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47621         LDKBolt12InvoiceFeatures this_arg_conv;
47622         this_arg_conv.inner = untag_ptr(this_arg);
47623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47625         this_arg_conv.is_owned = false;
47626         LDKBolt12InvoiceFeatures other_conv;
47627         other_conv.inner = untag_ptr(other);
47628         other_conv.is_owned = ptr_is_owned(other);
47629         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47630         other_conv.is_owned = false;
47631         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47632         return ret_conv;
47633 }
47634
47635 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
47636         LDKBolt12InvoiceFeatures this_arg_conv;
47637         this_arg_conv.inner = untag_ptr(this_arg);
47638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47640         this_arg_conv.is_owned = false;
47641         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
47642         return ret_conv;
47643 }
47644
47645 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47646         LDKBolt12InvoiceFeatures this_arg_conv;
47647         this_arg_conv.inner = untag_ptr(this_arg);
47648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47650         this_arg_conv.is_owned = false;
47651         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47652         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
47653         return tag_ptr(ret_conv, true);
47654 }
47655
47656 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47657         LDKBolt12InvoiceFeatures this_arg_conv;
47658         this_arg_conv.inner = untag_ptr(this_arg);
47659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47661         this_arg_conv.is_owned = false;
47662         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47663         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47664         return tag_ptr(ret_conv, true);
47665 }
47666
47667 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
47668         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
47669         uint64_t ret_ref = 0;
47670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47672         return ret_ref;
47673 }
47674
47675 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47676         LDKBlindedHopFeatures this_arg_conv;
47677         this_arg_conv.inner = untag_ptr(this_arg);
47678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47680         this_arg_conv.is_owned = false;
47681         LDKBlindedHopFeatures other_conv;
47682         other_conv.inner = untag_ptr(other);
47683         other_conv.is_owned = ptr_is_owned(other);
47684         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47685         other_conv.is_owned = false;
47686         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47687         return ret_conv;
47688 }
47689
47690 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
47691         LDKBlindedHopFeatures this_arg_conv;
47692         this_arg_conv.inner = untag_ptr(this_arg);
47693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47695         this_arg_conv.is_owned = false;
47696         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
47697         return ret_conv;
47698 }
47699
47700 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47701         LDKBlindedHopFeatures this_arg_conv;
47702         this_arg_conv.inner = untag_ptr(this_arg);
47703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47705         this_arg_conv.is_owned = false;
47706         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47707         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
47708         return tag_ptr(ret_conv, true);
47709 }
47710
47711 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47712         LDKBlindedHopFeatures this_arg_conv;
47713         this_arg_conv.inner = untag_ptr(this_arg);
47714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47716         this_arg_conv.is_owned = false;
47717         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47718         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47719         return tag_ptr(ret_conv, true);
47720 }
47721
47722 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
47723         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
47724         uint64_t ret_ref = 0;
47725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47727         return ret_ref;
47728 }
47729
47730 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47731         LDKChannelTypeFeatures this_arg_conv;
47732         this_arg_conv.inner = untag_ptr(this_arg);
47733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47735         this_arg_conv.is_owned = false;
47736         LDKChannelTypeFeatures other_conv;
47737         other_conv.inner = untag_ptr(other);
47738         other_conv.is_owned = ptr_is_owned(other);
47739         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47740         other_conv.is_owned = false;
47741         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47742         return ret_conv;
47743 }
47744
47745 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
47746         LDKChannelTypeFeatures this_arg_conv;
47747         this_arg_conv.inner = untag_ptr(this_arg);
47748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47750         this_arg_conv.is_owned = false;
47751         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
47752         return ret_conv;
47753 }
47754
47755 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47756         LDKChannelTypeFeatures this_arg_conv;
47757         this_arg_conv.inner = untag_ptr(this_arg);
47758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47760         this_arg_conv.is_owned = false;
47761         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47762         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
47763         return tag_ptr(ret_conv, true);
47764 }
47765
47766 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47767         LDKChannelTypeFeatures this_arg_conv;
47768         this_arg_conv.inner = untag_ptr(this_arg);
47769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47771         this_arg_conv.is_owned = false;
47772         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47773         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47774         return tag_ptr(ret_conv, true);
47775 }
47776
47777 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
47778         LDKInitFeatures obj_conv;
47779         obj_conv.inner = untag_ptr(obj);
47780         obj_conv.is_owned = ptr_is_owned(obj);
47781         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47782         obj_conv.is_owned = false;
47783         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
47784         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47785         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47786         CVec_u8Z_free(ret_var);
47787         return ret_arr;
47788 }
47789
47790 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
47791         LDKu8slice ser_ref;
47792         ser_ref.datalen = ser->arr_len;
47793         ser_ref.data = ser->elems;
47794         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
47795         *ret_conv = InitFeatures_read(ser_ref);
47796         FREE(ser);
47797         return tag_ptr(ret_conv, true);
47798 }
47799
47800 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
47801         LDKChannelFeatures obj_conv;
47802         obj_conv.inner = untag_ptr(obj);
47803         obj_conv.is_owned = ptr_is_owned(obj);
47804         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47805         obj_conv.is_owned = false;
47806         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
47807         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47808         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47809         CVec_u8Z_free(ret_var);
47810         return ret_arr;
47811 }
47812
47813 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
47814         LDKu8slice ser_ref;
47815         ser_ref.datalen = ser->arr_len;
47816         ser_ref.data = ser->elems;
47817         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
47818         *ret_conv = ChannelFeatures_read(ser_ref);
47819         FREE(ser);
47820         return tag_ptr(ret_conv, true);
47821 }
47822
47823 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
47824         LDKNodeFeatures obj_conv;
47825         obj_conv.inner = untag_ptr(obj);
47826         obj_conv.is_owned = ptr_is_owned(obj);
47827         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47828         obj_conv.is_owned = false;
47829         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
47830         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47831         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47832         CVec_u8Z_free(ret_var);
47833         return ret_arr;
47834 }
47835
47836 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
47837         LDKu8slice ser_ref;
47838         ser_ref.datalen = ser->arr_len;
47839         ser_ref.data = ser->elems;
47840         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
47841         *ret_conv = NodeFeatures_read(ser_ref);
47842         FREE(ser);
47843         return tag_ptr(ret_conv, true);
47844 }
47845
47846 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
47847         LDKBolt11InvoiceFeatures obj_conv;
47848         obj_conv.inner = untag_ptr(obj);
47849         obj_conv.is_owned = ptr_is_owned(obj);
47850         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47851         obj_conv.is_owned = false;
47852         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
47853         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47854         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47855         CVec_u8Z_free(ret_var);
47856         return ret_arr;
47857 }
47858
47859 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
47860         LDKu8slice ser_ref;
47861         ser_ref.datalen = ser->arr_len;
47862         ser_ref.data = ser->elems;
47863         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
47864         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
47865         FREE(ser);
47866         return tag_ptr(ret_conv, true);
47867 }
47868
47869 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
47870         LDKBolt12InvoiceFeatures obj_conv;
47871         obj_conv.inner = untag_ptr(obj);
47872         obj_conv.is_owned = ptr_is_owned(obj);
47873         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47874         obj_conv.is_owned = false;
47875         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
47876         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47877         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47878         CVec_u8Z_free(ret_var);
47879         return ret_arr;
47880 }
47881
47882 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
47883         LDKu8slice ser_ref;
47884         ser_ref.datalen = ser->arr_len;
47885         ser_ref.data = ser->elems;
47886         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
47887         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
47888         FREE(ser);
47889         return tag_ptr(ret_conv, true);
47890 }
47891
47892 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
47893         LDKBlindedHopFeatures obj_conv;
47894         obj_conv.inner = untag_ptr(obj);
47895         obj_conv.is_owned = ptr_is_owned(obj);
47896         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47897         obj_conv.is_owned = false;
47898         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
47899         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47900         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47901         CVec_u8Z_free(ret_var);
47902         return ret_arr;
47903 }
47904
47905 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
47906         LDKu8slice ser_ref;
47907         ser_ref.datalen = ser->arr_len;
47908         ser_ref.data = ser->elems;
47909         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
47910         *ret_conv = BlindedHopFeatures_read(ser_ref);
47911         FREE(ser);
47912         return tag_ptr(ret_conv, true);
47913 }
47914
47915 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
47916         LDKChannelTypeFeatures obj_conv;
47917         obj_conv.inner = untag_ptr(obj);
47918         obj_conv.is_owned = ptr_is_owned(obj);
47919         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47920         obj_conv.is_owned = false;
47921         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
47922         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47923         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47924         CVec_u8Z_free(ret_var);
47925         return ret_arr;
47926 }
47927
47928 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
47929         LDKu8slice ser_ref;
47930         ser_ref.datalen = ser->arr_len;
47931         ser_ref.data = ser->elems;
47932         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
47933         *ret_conv = ChannelTypeFeatures_read(ser_ref);
47934         FREE(ser);
47935         return tag_ptr(ret_conv, true);
47936 }
47937
47938 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
47939         LDKInitFeatures this_arg_conv;
47940         this_arg_conv.inner = untag_ptr(this_arg);
47941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47943         this_arg_conv.is_owned = false;
47944         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
47945 }
47946
47947 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
47948         LDKInitFeatures this_arg_conv;
47949         this_arg_conv.inner = untag_ptr(this_arg);
47950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47952         this_arg_conv.is_owned = false;
47953         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
47954 }
47955
47956 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
47957         LDKInitFeatures this_arg_conv;
47958         this_arg_conv.inner = untag_ptr(this_arg);
47959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47961         this_arg_conv.is_owned = false;
47962         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
47963         return ret_conv;
47964 }
47965
47966 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
47967         LDKNodeFeatures this_arg_conv;
47968         this_arg_conv.inner = untag_ptr(this_arg);
47969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47971         this_arg_conv.is_owned = false;
47972         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
47973 }
47974
47975 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
47976         LDKNodeFeatures this_arg_conv;
47977         this_arg_conv.inner = untag_ptr(this_arg);
47978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47980         this_arg_conv.is_owned = false;
47981         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
47982 }
47983
47984 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
47985         LDKNodeFeatures this_arg_conv;
47986         this_arg_conv.inner = untag_ptr(this_arg);
47987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47989         this_arg_conv.is_owned = false;
47990         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
47991         return ret_conv;
47992 }
47993
47994 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
47995         LDKInitFeatures this_arg_conv;
47996         this_arg_conv.inner = untag_ptr(this_arg);
47997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47999         this_arg_conv.is_owned = false;
48000         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
48001         return ret_conv;
48002 }
48003
48004 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
48005         LDKNodeFeatures this_arg_conv;
48006         this_arg_conv.inner = untag_ptr(this_arg);
48007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48009         this_arg_conv.is_owned = false;
48010         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
48011         return ret_conv;
48012 }
48013
48014 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
48015         LDKInitFeatures this_arg_conv;
48016         this_arg_conv.inner = untag_ptr(this_arg);
48017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48019         this_arg_conv.is_owned = false;
48020         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
48021 }
48022
48023 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
48024         LDKInitFeatures this_arg_conv;
48025         this_arg_conv.inner = untag_ptr(this_arg);
48026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48028         this_arg_conv.is_owned = false;
48029         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
48030 }
48031
48032 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
48033         LDKInitFeatures this_arg_conv;
48034         this_arg_conv.inner = untag_ptr(this_arg);
48035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48037         this_arg_conv.is_owned = false;
48038         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
48039         return ret_conv;
48040 }
48041
48042 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
48043         LDKInitFeatures this_arg_conv;
48044         this_arg_conv.inner = untag_ptr(this_arg);
48045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48047         this_arg_conv.is_owned = false;
48048         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
48049 }
48050
48051 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
48052         LDKInitFeatures this_arg_conv;
48053         this_arg_conv.inner = untag_ptr(this_arg);
48054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48056         this_arg_conv.is_owned = false;
48057         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
48058 }
48059
48060 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
48061         LDKInitFeatures this_arg_conv;
48062         this_arg_conv.inner = untag_ptr(this_arg);
48063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48065         this_arg_conv.is_owned = false;
48066         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
48067         return ret_conv;
48068 }
48069
48070 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
48071         LDKNodeFeatures this_arg_conv;
48072         this_arg_conv.inner = untag_ptr(this_arg);
48073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48075         this_arg_conv.is_owned = false;
48076         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
48077 }
48078
48079 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
48080         LDKNodeFeatures this_arg_conv;
48081         this_arg_conv.inner = untag_ptr(this_arg);
48082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48084         this_arg_conv.is_owned = false;
48085         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
48086 }
48087
48088 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
48089         LDKNodeFeatures this_arg_conv;
48090         this_arg_conv.inner = untag_ptr(this_arg);
48091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48093         this_arg_conv.is_owned = false;
48094         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
48095         return ret_conv;
48096 }
48097
48098 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
48099         LDKInitFeatures this_arg_conv;
48100         this_arg_conv.inner = untag_ptr(this_arg);
48101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48103         this_arg_conv.is_owned = false;
48104         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
48105         return ret_conv;
48106 }
48107
48108 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
48109         LDKNodeFeatures this_arg_conv;
48110         this_arg_conv.inner = untag_ptr(this_arg);
48111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48113         this_arg_conv.is_owned = false;
48114         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
48115         return ret_conv;
48116 }
48117
48118 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
48119         LDKInitFeatures this_arg_conv;
48120         this_arg_conv.inner = untag_ptr(this_arg);
48121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48123         this_arg_conv.is_owned = false;
48124         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
48125 }
48126
48127 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
48128         LDKInitFeatures this_arg_conv;
48129         this_arg_conv.inner = untag_ptr(this_arg);
48130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48132         this_arg_conv.is_owned = false;
48133         InitFeatures_set_gossip_queries_required(&this_arg_conv);
48134 }
48135
48136 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
48137         LDKInitFeatures this_arg_conv;
48138         this_arg_conv.inner = untag_ptr(this_arg);
48139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48141         this_arg_conv.is_owned = false;
48142         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
48143         return ret_conv;
48144 }
48145
48146 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
48147         LDKNodeFeatures this_arg_conv;
48148         this_arg_conv.inner = untag_ptr(this_arg);
48149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48151         this_arg_conv.is_owned = false;
48152         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
48153 }
48154
48155 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
48156         LDKNodeFeatures this_arg_conv;
48157         this_arg_conv.inner = untag_ptr(this_arg);
48158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48160         this_arg_conv.is_owned = false;
48161         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
48162 }
48163
48164 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
48165         LDKNodeFeatures this_arg_conv;
48166         this_arg_conv.inner = untag_ptr(this_arg);
48167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48169         this_arg_conv.is_owned = false;
48170         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
48171         return ret_conv;
48172 }
48173
48174 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
48175         LDKInitFeatures this_arg_conv;
48176         this_arg_conv.inner = untag_ptr(this_arg);
48177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48179         this_arg_conv.is_owned = false;
48180         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
48181         return ret_conv;
48182 }
48183
48184 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
48185         LDKNodeFeatures this_arg_conv;
48186         this_arg_conv.inner = untag_ptr(this_arg);
48187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48189         this_arg_conv.is_owned = false;
48190         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
48191         return ret_conv;
48192 }
48193
48194 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
48195         LDKInitFeatures this_arg_conv;
48196         this_arg_conv.inner = untag_ptr(this_arg);
48197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48199         this_arg_conv.is_owned = false;
48200         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
48201 }
48202
48203 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
48204         LDKInitFeatures this_arg_conv;
48205         this_arg_conv.inner = untag_ptr(this_arg);
48206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48208         this_arg_conv.is_owned = false;
48209         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
48210 }
48211
48212 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
48213         LDKInitFeatures this_arg_conv;
48214         this_arg_conv.inner = untag_ptr(this_arg);
48215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48217         this_arg_conv.is_owned = false;
48218         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
48219         return ret_conv;
48220 }
48221
48222 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
48223         LDKNodeFeatures this_arg_conv;
48224         this_arg_conv.inner = untag_ptr(this_arg);
48225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48227         this_arg_conv.is_owned = false;
48228         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
48229 }
48230
48231 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
48232         LDKNodeFeatures this_arg_conv;
48233         this_arg_conv.inner = untag_ptr(this_arg);
48234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48236         this_arg_conv.is_owned = false;
48237         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
48238 }
48239
48240 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
48241         LDKNodeFeatures this_arg_conv;
48242         this_arg_conv.inner = untag_ptr(this_arg);
48243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48245         this_arg_conv.is_owned = false;
48246         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
48247         return ret_conv;
48248 }
48249
48250 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
48251         LDKBolt11InvoiceFeatures this_arg_conv;
48252         this_arg_conv.inner = untag_ptr(this_arg);
48253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48255         this_arg_conv.is_owned = false;
48256         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
48257 }
48258
48259 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
48260         LDKBolt11InvoiceFeatures this_arg_conv;
48261         this_arg_conv.inner = untag_ptr(this_arg);
48262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48264         this_arg_conv.is_owned = false;
48265         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
48266 }
48267
48268 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
48269         LDKBolt11InvoiceFeatures this_arg_conv;
48270         this_arg_conv.inner = untag_ptr(this_arg);
48271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48273         this_arg_conv.is_owned = false;
48274         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
48275         return ret_conv;
48276 }
48277
48278 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
48279         LDKInitFeatures this_arg_conv;
48280         this_arg_conv.inner = untag_ptr(this_arg);
48281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48283         this_arg_conv.is_owned = false;
48284         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
48285         return ret_conv;
48286 }
48287
48288 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
48289         LDKNodeFeatures this_arg_conv;
48290         this_arg_conv.inner = untag_ptr(this_arg);
48291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48293         this_arg_conv.is_owned = false;
48294         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
48295         return ret_conv;
48296 }
48297
48298 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
48299         LDKBolt11InvoiceFeatures this_arg_conv;
48300         this_arg_conv.inner = untag_ptr(this_arg);
48301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48303         this_arg_conv.is_owned = false;
48304         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
48305         return ret_conv;
48306 }
48307
48308 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
48309         LDKInitFeatures this_arg_conv;
48310         this_arg_conv.inner = untag_ptr(this_arg);
48311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48313         this_arg_conv.is_owned = false;
48314         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
48315 }
48316
48317 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
48318         LDKInitFeatures this_arg_conv;
48319         this_arg_conv.inner = untag_ptr(this_arg);
48320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48322         this_arg_conv.is_owned = false;
48323         InitFeatures_set_static_remote_key_required(&this_arg_conv);
48324 }
48325
48326 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
48327         LDKInitFeatures this_arg_conv;
48328         this_arg_conv.inner = untag_ptr(this_arg);
48329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48331         this_arg_conv.is_owned = false;
48332         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
48333         return ret_conv;
48334 }
48335
48336 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
48337         LDKNodeFeatures this_arg_conv;
48338         this_arg_conv.inner = untag_ptr(this_arg);
48339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48341         this_arg_conv.is_owned = false;
48342         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
48343 }
48344
48345 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
48346         LDKNodeFeatures this_arg_conv;
48347         this_arg_conv.inner = untag_ptr(this_arg);
48348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48350         this_arg_conv.is_owned = false;
48351         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
48352 }
48353
48354 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
48355         LDKNodeFeatures this_arg_conv;
48356         this_arg_conv.inner = untag_ptr(this_arg);
48357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48359         this_arg_conv.is_owned = false;
48360         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
48361         return ret_conv;
48362 }
48363
48364 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
48365         LDKChannelTypeFeatures this_arg_conv;
48366         this_arg_conv.inner = untag_ptr(this_arg);
48367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48369         this_arg_conv.is_owned = false;
48370         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
48371 }
48372
48373 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
48374         LDKChannelTypeFeatures this_arg_conv;
48375         this_arg_conv.inner = untag_ptr(this_arg);
48376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48378         this_arg_conv.is_owned = false;
48379         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
48380 }
48381
48382 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
48383         LDKChannelTypeFeatures this_arg_conv;
48384         this_arg_conv.inner = untag_ptr(this_arg);
48385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48387         this_arg_conv.is_owned = false;
48388         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
48389         return ret_conv;
48390 }
48391
48392 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
48393         LDKInitFeatures this_arg_conv;
48394         this_arg_conv.inner = untag_ptr(this_arg);
48395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48397         this_arg_conv.is_owned = false;
48398         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
48399         return ret_conv;
48400 }
48401
48402 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
48403         LDKNodeFeatures this_arg_conv;
48404         this_arg_conv.inner = untag_ptr(this_arg);
48405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48407         this_arg_conv.is_owned = false;
48408         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
48409         return ret_conv;
48410 }
48411
48412 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
48413         LDKChannelTypeFeatures this_arg_conv;
48414         this_arg_conv.inner = untag_ptr(this_arg);
48415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48417         this_arg_conv.is_owned = false;
48418         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
48419         return ret_conv;
48420 }
48421
48422 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
48423         LDKInitFeatures this_arg_conv;
48424         this_arg_conv.inner = untag_ptr(this_arg);
48425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48427         this_arg_conv.is_owned = false;
48428         InitFeatures_set_payment_secret_optional(&this_arg_conv);
48429 }
48430
48431 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
48432         LDKInitFeatures this_arg_conv;
48433         this_arg_conv.inner = untag_ptr(this_arg);
48434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48436         this_arg_conv.is_owned = false;
48437         InitFeatures_set_payment_secret_required(&this_arg_conv);
48438 }
48439
48440 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
48441         LDKInitFeatures this_arg_conv;
48442         this_arg_conv.inner = untag_ptr(this_arg);
48443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48445         this_arg_conv.is_owned = false;
48446         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
48447         return ret_conv;
48448 }
48449
48450 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
48451         LDKNodeFeatures this_arg_conv;
48452         this_arg_conv.inner = untag_ptr(this_arg);
48453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48455         this_arg_conv.is_owned = false;
48456         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
48457 }
48458
48459 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
48460         LDKNodeFeatures this_arg_conv;
48461         this_arg_conv.inner = untag_ptr(this_arg);
48462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48464         this_arg_conv.is_owned = false;
48465         NodeFeatures_set_payment_secret_required(&this_arg_conv);
48466 }
48467
48468 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
48469         LDKNodeFeatures this_arg_conv;
48470         this_arg_conv.inner = untag_ptr(this_arg);
48471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48473         this_arg_conv.is_owned = false;
48474         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
48475         return ret_conv;
48476 }
48477
48478 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
48479         LDKBolt11InvoiceFeatures this_arg_conv;
48480         this_arg_conv.inner = untag_ptr(this_arg);
48481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48483         this_arg_conv.is_owned = false;
48484         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
48485 }
48486
48487 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
48488         LDKBolt11InvoiceFeatures this_arg_conv;
48489         this_arg_conv.inner = untag_ptr(this_arg);
48490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48492         this_arg_conv.is_owned = false;
48493         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
48494 }
48495
48496 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
48497         LDKBolt11InvoiceFeatures this_arg_conv;
48498         this_arg_conv.inner = untag_ptr(this_arg);
48499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48501         this_arg_conv.is_owned = false;
48502         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
48503         return ret_conv;
48504 }
48505
48506 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
48507         LDKInitFeatures this_arg_conv;
48508         this_arg_conv.inner = untag_ptr(this_arg);
48509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48511         this_arg_conv.is_owned = false;
48512         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
48513         return ret_conv;
48514 }
48515
48516 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
48517         LDKNodeFeatures this_arg_conv;
48518         this_arg_conv.inner = untag_ptr(this_arg);
48519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48521         this_arg_conv.is_owned = false;
48522         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
48523         return ret_conv;
48524 }
48525
48526 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
48527         LDKBolt11InvoiceFeatures this_arg_conv;
48528         this_arg_conv.inner = untag_ptr(this_arg);
48529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48531         this_arg_conv.is_owned = false;
48532         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
48533         return ret_conv;
48534 }
48535
48536 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
48537         LDKInitFeatures this_arg_conv;
48538         this_arg_conv.inner = untag_ptr(this_arg);
48539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48541         this_arg_conv.is_owned = false;
48542         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
48543 }
48544
48545 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
48546         LDKInitFeatures this_arg_conv;
48547         this_arg_conv.inner = untag_ptr(this_arg);
48548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48550         this_arg_conv.is_owned = false;
48551         InitFeatures_set_basic_mpp_required(&this_arg_conv);
48552 }
48553
48554 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
48555         LDKInitFeatures this_arg_conv;
48556         this_arg_conv.inner = untag_ptr(this_arg);
48557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48559         this_arg_conv.is_owned = false;
48560         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
48561         return ret_conv;
48562 }
48563
48564 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
48565         LDKNodeFeatures this_arg_conv;
48566         this_arg_conv.inner = untag_ptr(this_arg);
48567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48569         this_arg_conv.is_owned = false;
48570         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
48571 }
48572
48573 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
48574         LDKNodeFeatures this_arg_conv;
48575         this_arg_conv.inner = untag_ptr(this_arg);
48576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48578         this_arg_conv.is_owned = false;
48579         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
48580 }
48581
48582 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
48583         LDKNodeFeatures this_arg_conv;
48584         this_arg_conv.inner = untag_ptr(this_arg);
48585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48587         this_arg_conv.is_owned = false;
48588         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
48589         return ret_conv;
48590 }
48591
48592 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
48593         LDKBolt11InvoiceFeatures this_arg_conv;
48594         this_arg_conv.inner = untag_ptr(this_arg);
48595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48597         this_arg_conv.is_owned = false;
48598         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
48599 }
48600
48601 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
48602         LDKBolt11InvoiceFeatures this_arg_conv;
48603         this_arg_conv.inner = untag_ptr(this_arg);
48604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48606         this_arg_conv.is_owned = false;
48607         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
48608 }
48609
48610 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
48611         LDKBolt11InvoiceFeatures this_arg_conv;
48612         this_arg_conv.inner = untag_ptr(this_arg);
48613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48615         this_arg_conv.is_owned = false;
48616         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
48617         return ret_conv;
48618 }
48619
48620 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
48621         LDKBolt12InvoiceFeatures this_arg_conv;
48622         this_arg_conv.inner = untag_ptr(this_arg);
48623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48625         this_arg_conv.is_owned = false;
48626         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
48627 }
48628
48629 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
48630         LDKBolt12InvoiceFeatures this_arg_conv;
48631         this_arg_conv.inner = untag_ptr(this_arg);
48632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48634         this_arg_conv.is_owned = false;
48635         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
48636 }
48637
48638 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
48639         LDKBolt12InvoiceFeatures this_arg_conv;
48640         this_arg_conv.inner = untag_ptr(this_arg);
48641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48643         this_arg_conv.is_owned = false;
48644         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
48645         return ret_conv;
48646 }
48647
48648 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
48649         LDKInitFeatures this_arg_conv;
48650         this_arg_conv.inner = untag_ptr(this_arg);
48651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48653         this_arg_conv.is_owned = false;
48654         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
48655         return ret_conv;
48656 }
48657
48658 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
48659         LDKNodeFeatures this_arg_conv;
48660         this_arg_conv.inner = untag_ptr(this_arg);
48661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48663         this_arg_conv.is_owned = false;
48664         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
48665         return ret_conv;
48666 }
48667
48668 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
48669         LDKBolt11InvoiceFeatures this_arg_conv;
48670         this_arg_conv.inner = untag_ptr(this_arg);
48671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48673         this_arg_conv.is_owned = false;
48674         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
48675         return ret_conv;
48676 }
48677
48678 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
48679         LDKBolt12InvoiceFeatures this_arg_conv;
48680         this_arg_conv.inner = untag_ptr(this_arg);
48681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48683         this_arg_conv.is_owned = false;
48684         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
48685         return ret_conv;
48686 }
48687
48688 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
48689         LDKInitFeatures this_arg_conv;
48690         this_arg_conv.inner = untag_ptr(this_arg);
48691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48693         this_arg_conv.is_owned = false;
48694         InitFeatures_set_wumbo_optional(&this_arg_conv);
48695 }
48696
48697 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
48698         LDKInitFeatures this_arg_conv;
48699         this_arg_conv.inner = untag_ptr(this_arg);
48700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48702         this_arg_conv.is_owned = false;
48703         InitFeatures_set_wumbo_required(&this_arg_conv);
48704 }
48705
48706 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
48707         LDKInitFeatures this_arg_conv;
48708         this_arg_conv.inner = untag_ptr(this_arg);
48709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48711         this_arg_conv.is_owned = false;
48712         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
48713         return ret_conv;
48714 }
48715
48716 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
48717         LDKNodeFeatures this_arg_conv;
48718         this_arg_conv.inner = untag_ptr(this_arg);
48719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48721         this_arg_conv.is_owned = false;
48722         NodeFeatures_set_wumbo_optional(&this_arg_conv);
48723 }
48724
48725 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
48726         LDKNodeFeatures this_arg_conv;
48727         this_arg_conv.inner = untag_ptr(this_arg);
48728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48730         this_arg_conv.is_owned = false;
48731         NodeFeatures_set_wumbo_required(&this_arg_conv);
48732 }
48733
48734 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
48735         LDKNodeFeatures this_arg_conv;
48736         this_arg_conv.inner = untag_ptr(this_arg);
48737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48739         this_arg_conv.is_owned = false;
48740         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
48741         return ret_conv;
48742 }
48743
48744 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
48745         LDKInitFeatures this_arg_conv;
48746         this_arg_conv.inner = untag_ptr(this_arg);
48747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48749         this_arg_conv.is_owned = false;
48750         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
48751         return ret_conv;
48752 }
48753
48754 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
48755         LDKNodeFeatures this_arg_conv;
48756         this_arg_conv.inner = untag_ptr(this_arg);
48757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48759         this_arg_conv.is_owned = false;
48760         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
48761         return ret_conv;
48762 }
48763
48764 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) {
48765         LDKInitFeatures this_arg_conv;
48766         this_arg_conv.inner = untag_ptr(this_arg);
48767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48769         this_arg_conv.is_owned = false;
48770         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
48771 }
48772
48773 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) {
48774         LDKInitFeatures this_arg_conv;
48775         this_arg_conv.inner = untag_ptr(this_arg);
48776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48778         this_arg_conv.is_owned = false;
48779         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
48780 }
48781
48782 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48783         LDKInitFeatures this_arg_conv;
48784         this_arg_conv.inner = untag_ptr(this_arg);
48785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48787         this_arg_conv.is_owned = false;
48788         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48789         return ret_conv;
48790 }
48791
48792 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) {
48793         LDKNodeFeatures this_arg_conv;
48794         this_arg_conv.inner = untag_ptr(this_arg);
48795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48797         this_arg_conv.is_owned = false;
48798         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
48799 }
48800
48801 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) {
48802         LDKNodeFeatures this_arg_conv;
48803         this_arg_conv.inner = untag_ptr(this_arg);
48804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48806         this_arg_conv.is_owned = false;
48807         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
48808 }
48809
48810 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48811         LDKNodeFeatures this_arg_conv;
48812         this_arg_conv.inner = untag_ptr(this_arg);
48813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48815         this_arg_conv.is_owned = false;
48816         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48817         return ret_conv;
48818 }
48819
48820 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) {
48821         LDKChannelTypeFeatures this_arg_conv;
48822         this_arg_conv.inner = untag_ptr(this_arg);
48823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48825         this_arg_conv.is_owned = false;
48826         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
48827 }
48828
48829 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) {
48830         LDKChannelTypeFeatures this_arg_conv;
48831         this_arg_conv.inner = untag_ptr(this_arg);
48832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48834         this_arg_conv.is_owned = false;
48835         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
48836 }
48837
48838 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48839         LDKChannelTypeFeatures this_arg_conv;
48840         this_arg_conv.inner = untag_ptr(this_arg);
48841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48843         this_arg_conv.is_owned = false;
48844         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48845         return ret_conv;
48846 }
48847
48848 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48849         LDKInitFeatures this_arg_conv;
48850         this_arg_conv.inner = untag_ptr(this_arg);
48851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48853         this_arg_conv.is_owned = false;
48854         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48855         return ret_conv;
48856 }
48857
48858 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48859         LDKNodeFeatures this_arg_conv;
48860         this_arg_conv.inner = untag_ptr(this_arg);
48861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48863         this_arg_conv.is_owned = false;
48864         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48865         return ret_conv;
48866 }
48867
48868 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48869         LDKChannelTypeFeatures this_arg_conv;
48870         this_arg_conv.inner = untag_ptr(this_arg);
48871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48873         this_arg_conv.is_owned = false;
48874         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48875         return ret_conv;
48876 }
48877
48878 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) {
48879         LDKInitFeatures this_arg_conv;
48880         this_arg_conv.inner = untag_ptr(this_arg);
48881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48883         this_arg_conv.is_owned = false;
48884         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
48885 }
48886
48887 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) {
48888         LDKInitFeatures this_arg_conv;
48889         this_arg_conv.inner = untag_ptr(this_arg);
48890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48892         this_arg_conv.is_owned = false;
48893         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
48894 }
48895
48896 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48897         LDKInitFeatures this_arg_conv;
48898         this_arg_conv.inner = untag_ptr(this_arg);
48899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48901         this_arg_conv.is_owned = false;
48902         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
48903         return ret_conv;
48904 }
48905
48906 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) {
48907         LDKNodeFeatures this_arg_conv;
48908         this_arg_conv.inner = untag_ptr(this_arg);
48909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48911         this_arg_conv.is_owned = false;
48912         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
48913 }
48914
48915 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) {
48916         LDKNodeFeatures this_arg_conv;
48917         this_arg_conv.inner = untag_ptr(this_arg);
48918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48920         this_arg_conv.is_owned = false;
48921         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
48922 }
48923
48924 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48925         LDKNodeFeatures this_arg_conv;
48926         this_arg_conv.inner = untag_ptr(this_arg);
48927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48929         this_arg_conv.is_owned = false;
48930         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
48931         return ret_conv;
48932 }
48933
48934 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) {
48935         LDKChannelTypeFeatures this_arg_conv;
48936         this_arg_conv.inner = untag_ptr(this_arg);
48937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48939         this_arg_conv.is_owned = false;
48940         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
48941 }
48942
48943 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) {
48944         LDKChannelTypeFeatures this_arg_conv;
48945         this_arg_conv.inner = untag_ptr(this_arg);
48946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48948         this_arg_conv.is_owned = false;
48949         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
48950 }
48951
48952 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48953         LDKChannelTypeFeatures this_arg_conv;
48954         this_arg_conv.inner = untag_ptr(this_arg);
48955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48957         this_arg_conv.is_owned = false;
48958         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
48959         return ret_conv;
48960 }
48961
48962 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48963         LDKInitFeatures this_arg_conv;
48964         this_arg_conv.inner = untag_ptr(this_arg);
48965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48967         this_arg_conv.is_owned = false;
48968         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
48969         return ret_conv;
48970 }
48971
48972 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48973         LDKNodeFeatures this_arg_conv;
48974         this_arg_conv.inner = untag_ptr(this_arg);
48975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48977         this_arg_conv.is_owned = false;
48978         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
48979         return ret_conv;
48980 }
48981
48982 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48983         LDKChannelTypeFeatures this_arg_conv;
48984         this_arg_conv.inner = untag_ptr(this_arg);
48985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48987         this_arg_conv.is_owned = false;
48988         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
48989         return ret_conv;
48990 }
48991
48992 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
48993         LDKInitFeatures this_arg_conv;
48994         this_arg_conv.inner = untag_ptr(this_arg);
48995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48997         this_arg_conv.is_owned = false;
48998         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
48999 }
49000
49001 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
49002         LDKInitFeatures this_arg_conv;
49003         this_arg_conv.inner = untag_ptr(this_arg);
49004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49006         this_arg_conv.is_owned = false;
49007         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
49008 }
49009
49010 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
49011         LDKInitFeatures this_arg_conv;
49012         this_arg_conv.inner = untag_ptr(this_arg);
49013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49015         this_arg_conv.is_owned = false;
49016         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
49017         return ret_conv;
49018 }
49019
49020 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
49021         LDKNodeFeatures this_arg_conv;
49022         this_arg_conv.inner = untag_ptr(this_arg);
49023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49025         this_arg_conv.is_owned = false;
49026         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
49027 }
49028
49029 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
49030         LDKNodeFeatures this_arg_conv;
49031         this_arg_conv.inner = untag_ptr(this_arg);
49032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49034         this_arg_conv.is_owned = false;
49035         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
49036 }
49037
49038 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
49039         LDKNodeFeatures this_arg_conv;
49040         this_arg_conv.inner = untag_ptr(this_arg);
49041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49043         this_arg_conv.is_owned = false;
49044         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
49045         return ret_conv;
49046 }
49047
49048 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
49049         LDKInitFeatures this_arg_conv;
49050         this_arg_conv.inner = untag_ptr(this_arg);
49051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49053         this_arg_conv.is_owned = false;
49054         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
49055         return ret_conv;
49056 }
49057
49058 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
49059         LDKNodeFeatures this_arg_conv;
49060         this_arg_conv.inner = untag_ptr(this_arg);
49061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49063         this_arg_conv.is_owned = false;
49064         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
49065         return ret_conv;
49066 }
49067
49068 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
49069         LDKInitFeatures this_arg_conv;
49070         this_arg_conv.inner = untag_ptr(this_arg);
49071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49073         this_arg_conv.is_owned = false;
49074         InitFeatures_set_onion_messages_optional(&this_arg_conv);
49075 }
49076
49077 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
49078         LDKInitFeatures this_arg_conv;
49079         this_arg_conv.inner = untag_ptr(this_arg);
49080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49082         this_arg_conv.is_owned = false;
49083         InitFeatures_set_onion_messages_required(&this_arg_conv);
49084 }
49085
49086 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
49087         LDKInitFeatures this_arg_conv;
49088         this_arg_conv.inner = untag_ptr(this_arg);
49089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49091         this_arg_conv.is_owned = false;
49092         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
49093         return ret_conv;
49094 }
49095
49096 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
49097         LDKNodeFeatures this_arg_conv;
49098         this_arg_conv.inner = untag_ptr(this_arg);
49099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49101         this_arg_conv.is_owned = false;
49102         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
49103 }
49104
49105 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
49106         LDKNodeFeatures this_arg_conv;
49107         this_arg_conv.inner = untag_ptr(this_arg);
49108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49110         this_arg_conv.is_owned = false;
49111         NodeFeatures_set_onion_messages_required(&this_arg_conv);
49112 }
49113
49114 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
49115         LDKNodeFeatures this_arg_conv;
49116         this_arg_conv.inner = untag_ptr(this_arg);
49117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49119         this_arg_conv.is_owned = false;
49120         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
49121         return ret_conv;
49122 }
49123
49124 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
49125         LDKInitFeatures this_arg_conv;
49126         this_arg_conv.inner = untag_ptr(this_arg);
49127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49129         this_arg_conv.is_owned = false;
49130         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
49131         return ret_conv;
49132 }
49133
49134 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
49135         LDKNodeFeatures this_arg_conv;
49136         this_arg_conv.inner = untag_ptr(this_arg);
49137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49139         this_arg_conv.is_owned = false;
49140         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
49141         return ret_conv;
49142 }
49143
49144 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
49145         LDKInitFeatures this_arg_conv;
49146         this_arg_conv.inner = untag_ptr(this_arg);
49147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49149         this_arg_conv.is_owned = false;
49150         InitFeatures_set_channel_type_optional(&this_arg_conv);
49151 }
49152
49153 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
49154         LDKInitFeatures this_arg_conv;
49155         this_arg_conv.inner = untag_ptr(this_arg);
49156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49158         this_arg_conv.is_owned = false;
49159         InitFeatures_set_channel_type_required(&this_arg_conv);
49160 }
49161
49162 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
49163         LDKInitFeatures this_arg_conv;
49164         this_arg_conv.inner = untag_ptr(this_arg);
49165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49167         this_arg_conv.is_owned = false;
49168         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
49169         return ret_conv;
49170 }
49171
49172 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
49173         LDKNodeFeatures this_arg_conv;
49174         this_arg_conv.inner = untag_ptr(this_arg);
49175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49177         this_arg_conv.is_owned = false;
49178         NodeFeatures_set_channel_type_optional(&this_arg_conv);
49179 }
49180
49181 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
49182         LDKNodeFeatures this_arg_conv;
49183         this_arg_conv.inner = untag_ptr(this_arg);
49184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49186         this_arg_conv.is_owned = false;
49187         NodeFeatures_set_channel_type_required(&this_arg_conv);
49188 }
49189
49190 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
49191         LDKNodeFeatures this_arg_conv;
49192         this_arg_conv.inner = untag_ptr(this_arg);
49193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49195         this_arg_conv.is_owned = false;
49196         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
49197         return ret_conv;
49198 }
49199
49200 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
49201         LDKInitFeatures this_arg_conv;
49202         this_arg_conv.inner = untag_ptr(this_arg);
49203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49205         this_arg_conv.is_owned = false;
49206         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
49207         return ret_conv;
49208 }
49209
49210 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
49211         LDKNodeFeatures this_arg_conv;
49212         this_arg_conv.inner = untag_ptr(this_arg);
49213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49215         this_arg_conv.is_owned = false;
49216         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
49217         return ret_conv;
49218 }
49219
49220 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
49221         LDKInitFeatures this_arg_conv;
49222         this_arg_conv.inner = untag_ptr(this_arg);
49223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49225         this_arg_conv.is_owned = false;
49226         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
49227 }
49228
49229 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
49230         LDKInitFeatures this_arg_conv;
49231         this_arg_conv.inner = untag_ptr(this_arg);
49232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49234         this_arg_conv.is_owned = false;
49235         InitFeatures_set_scid_privacy_required(&this_arg_conv);
49236 }
49237
49238 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
49239         LDKInitFeatures this_arg_conv;
49240         this_arg_conv.inner = untag_ptr(this_arg);
49241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49243         this_arg_conv.is_owned = false;
49244         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
49245         return ret_conv;
49246 }
49247
49248 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
49249         LDKNodeFeatures this_arg_conv;
49250         this_arg_conv.inner = untag_ptr(this_arg);
49251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49253         this_arg_conv.is_owned = false;
49254         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
49255 }
49256
49257 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
49258         LDKNodeFeatures this_arg_conv;
49259         this_arg_conv.inner = untag_ptr(this_arg);
49260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49262         this_arg_conv.is_owned = false;
49263         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
49264 }
49265
49266 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
49267         LDKNodeFeatures this_arg_conv;
49268         this_arg_conv.inner = untag_ptr(this_arg);
49269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49271         this_arg_conv.is_owned = false;
49272         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
49273         return ret_conv;
49274 }
49275
49276 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
49277         LDKChannelTypeFeatures this_arg_conv;
49278         this_arg_conv.inner = untag_ptr(this_arg);
49279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49281         this_arg_conv.is_owned = false;
49282         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
49283 }
49284
49285 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
49286         LDKChannelTypeFeatures this_arg_conv;
49287         this_arg_conv.inner = untag_ptr(this_arg);
49288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49290         this_arg_conv.is_owned = false;
49291         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
49292 }
49293
49294 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
49295         LDKChannelTypeFeatures this_arg_conv;
49296         this_arg_conv.inner = untag_ptr(this_arg);
49297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49299         this_arg_conv.is_owned = false;
49300         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
49301         return ret_conv;
49302 }
49303
49304 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
49305         LDKInitFeatures this_arg_conv;
49306         this_arg_conv.inner = untag_ptr(this_arg);
49307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49309         this_arg_conv.is_owned = false;
49310         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
49311         return ret_conv;
49312 }
49313
49314 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
49315         LDKNodeFeatures this_arg_conv;
49316         this_arg_conv.inner = untag_ptr(this_arg);
49317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49319         this_arg_conv.is_owned = false;
49320         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
49321         return ret_conv;
49322 }
49323
49324 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
49325         LDKChannelTypeFeatures this_arg_conv;
49326         this_arg_conv.inner = untag_ptr(this_arg);
49327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49329         this_arg_conv.is_owned = false;
49330         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
49331         return ret_conv;
49332 }
49333
49334 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
49335         LDKBolt11InvoiceFeatures this_arg_conv;
49336         this_arg_conv.inner = untag_ptr(this_arg);
49337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49339         this_arg_conv.is_owned = false;
49340         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
49341 }
49342
49343 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
49344         LDKBolt11InvoiceFeatures this_arg_conv;
49345         this_arg_conv.inner = untag_ptr(this_arg);
49346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49348         this_arg_conv.is_owned = false;
49349         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
49350 }
49351
49352 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
49353         LDKBolt11InvoiceFeatures this_arg_conv;
49354         this_arg_conv.inner = untag_ptr(this_arg);
49355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49357         this_arg_conv.is_owned = false;
49358         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
49359         return ret_conv;
49360 }
49361
49362 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
49363         LDKBolt11InvoiceFeatures this_arg_conv;
49364         this_arg_conv.inner = untag_ptr(this_arg);
49365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49367         this_arg_conv.is_owned = false;
49368         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
49369         return ret_conv;
49370 }
49371
49372 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
49373         LDKInitFeatures this_arg_conv;
49374         this_arg_conv.inner = untag_ptr(this_arg);
49375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49377         this_arg_conv.is_owned = false;
49378         InitFeatures_set_zero_conf_optional(&this_arg_conv);
49379 }
49380
49381 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
49382         LDKInitFeatures this_arg_conv;
49383         this_arg_conv.inner = untag_ptr(this_arg);
49384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49386         this_arg_conv.is_owned = false;
49387         InitFeatures_set_zero_conf_required(&this_arg_conv);
49388 }
49389
49390 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
49391         LDKInitFeatures this_arg_conv;
49392         this_arg_conv.inner = untag_ptr(this_arg);
49393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49395         this_arg_conv.is_owned = false;
49396         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
49397         return ret_conv;
49398 }
49399
49400 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
49401         LDKNodeFeatures this_arg_conv;
49402         this_arg_conv.inner = untag_ptr(this_arg);
49403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49405         this_arg_conv.is_owned = false;
49406         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
49407 }
49408
49409 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
49410         LDKNodeFeatures this_arg_conv;
49411         this_arg_conv.inner = untag_ptr(this_arg);
49412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49414         this_arg_conv.is_owned = false;
49415         NodeFeatures_set_zero_conf_required(&this_arg_conv);
49416 }
49417
49418 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
49419         LDKNodeFeatures this_arg_conv;
49420         this_arg_conv.inner = untag_ptr(this_arg);
49421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49423         this_arg_conv.is_owned = false;
49424         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
49425         return ret_conv;
49426 }
49427
49428 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
49429         LDKChannelTypeFeatures this_arg_conv;
49430         this_arg_conv.inner = untag_ptr(this_arg);
49431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49433         this_arg_conv.is_owned = false;
49434         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
49435 }
49436
49437 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
49438         LDKChannelTypeFeatures this_arg_conv;
49439         this_arg_conv.inner = untag_ptr(this_arg);
49440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49442         this_arg_conv.is_owned = false;
49443         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
49444 }
49445
49446 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
49447         LDKChannelTypeFeatures this_arg_conv;
49448         this_arg_conv.inner = untag_ptr(this_arg);
49449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49451         this_arg_conv.is_owned = false;
49452         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
49453         return ret_conv;
49454 }
49455
49456 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
49457         LDKInitFeatures this_arg_conv;
49458         this_arg_conv.inner = untag_ptr(this_arg);
49459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49461         this_arg_conv.is_owned = false;
49462         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
49463         return ret_conv;
49464 }
49465
49466 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
49467         LDKNodeFeatures this_arg_conv;
49468         this_arg_conv.inner = untag_ptr(this_arg);
49469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49471         this_arg_conv.is_owned = false;
49472         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
49473         return ret_conv;
49474 }
49475
49476 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
49477         LDKChannelTypeFeatures this_arg_conv;
49478         this_arg_conv.inner = untag_ptr(this_arg);
49479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49481         this_arg_conv.is_owned = false;
49482         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
49483         return ret_conv;
49484 }
49485
49486 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
49487         LDKNodeFeatures this_arg_conv;
49488         this_arg_conv.inner = untag_ptr(this_arg);
49489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49491         this_arg_conv.is_owned = false;
49492         NodeFeatures_set_keysend_optional(&this_arg_conv);
49493 }
49494
49495 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
49496         LDKNodeFeatures this_arg_conv;
49497         this_arg_conv.inner = untag_ptr(this_arg);
49498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49500         this_arg_conv.is_owned = false;
49501         NodeFeatures_set_keysend_required(&this_arg_conv);
49502 }
49503
49504 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
49505         LDKNodeFeatures this_arg_conv;
49506         this_arg_conv.inner = untag_ptr(this_arg);
49507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49509         this_arg_conv.is_owned = false;
49510         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
49511         return ret_conv;
49512 }
49513
49514 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
49515         LDKNodeFeatures this_arg_conv;
49516         this_arg_conv.inner = untag_ptr(this_arg);
49517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49519         this_arg_conv.is_owned = false;
49520         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
49521         return ret_conv;
49522 }
49523
49524 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
49525         LDKShutdownScript this_obj_conv;
49526         this_obj_conv.inner = untag_ptr(this_obj);
49527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49529         ShutdownScript_free(this_obj_conv);
49530 }
49531
49532 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
49533         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
49534         uint64_t ret_ref = 0;
49535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49537         return ret_ref;
49538 }
49539 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
49540         LDKShutdownScript arg_conv;
49541         arg_conv.inner = untag_ptr(arg);
49542         arg_conv.is_owned = ptr_is_owned(arg);
49543         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49544         arg_conv.is_owned = false;
49545         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
49546         return ret_conv;
49547 }
49548
49549 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
49550         LDKShutdownScript orig_conv;
49551         orig_conv.inner = untag_ptr(orig);
49552         orig_conv.is_owned = ptr_is_owned(orig);
49553         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49554         orig_conv.is_owned = false;
49555         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
49556         uint64_t ret_ref = 0;
49557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49559         return ret_ref;
49560 }
49561
49562 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
49563         LDKShutdownScript a_conv;
49564         a_conv.inner = untag_ptr(a);
49565         a_conv.is_owned = ptr_is_owned(a);
49566         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49567         a_conv.is_owned = false;
49568         LDKShutdownScript b_conv;
49569         b_conv.inner = untag_ptr(b);
49570         b_conv.is_owned = ptr_is_owned(b);
49571         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49572         b_conv.is_owned = false;
49573         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
49574         return ret_conv;
49575 }
49576
49577 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
49578         LDKInvalidShutdownScript this_obj_conv;
49579         this_obj_conv.inner = untag_ptr(this_obj);
49580         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49582         InvalidShutdownScript_free(this_obj_conv);
49583 }
49584
49585 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
49586         LDKInvalidShutdownScript this_ptr_conv;
49587         this_ptr_conv.inner = untag_ptr(this_ptr);
49588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49590         this_ptr_conv.is_owned = false;
49591         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
49592         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49593         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49594         return ret_arr;
49595 }
49596
49597 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
49598         LDKInvalidShutdownScript this_ptr_conv;
49599         this_ptr_conv.inner = untag_ptr(this_ptr);
49600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49602         this_ptr_conv.is_owned = false;
49603         LDKCVec_u8Z val_ref;
49604         val_ref.datalen = val->arr_len;
49605         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49606         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49607         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
49608 }
49609
49610 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
49611         LDKCVec_u8Z script_arg_ref;
49612         script_arg_ref.datalen = script_arg->arr_len;
49613         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49614         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
49615         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
49616         uint64_t ret_ref = 0;
49617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49619         return ret_ref;
49620 }
49621
49622 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
49623         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
49624         uint64_t ret_ref = 0;
49625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49627         return ret_ref;
49628 }
49629 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
49630         LDKInvalidShutdownScript arg_conv;
49631         arg_conv.inner = untag_ptr(arg);
49632         arg_conv.is_owned = ptr_is_owned(arg);
49633         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49634         arg_conv.is_owned = false;
49635         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
49636         return ret_conv;
49637 }
49638
49639 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
49640         LDKInvalidShutdownScript orig_conv;
49641         orig_conv.inner = untag_ptr(orig);
49642         orig_conv.is_owned = ptr_is_owned(orig);
49643         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49644         orig_conv.is_owned = false;
49645         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
49646         uint64_t ret_ref = 0;
49647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49649         return ret_ref;
49650 }
49651
49652 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
49653         LDKShutdownScript obj_conv;
49654         obj_conv.inner = untag_ptr(obj);
49655         obj_conv.is_owned = ptr_is_owned(obj);
49656         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49657         obj_conv.is_owned = false;
49658         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
49659         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49660         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49661         CVec_u8Z_free(ret_var);
49662         return ret_arr;
49663 }
49664
49665 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
49666         LDKu8slice ser_ref;
49667         ser_ref.datalen = ser->arr_len;
49668         ser_ref.data = ser->elems;
49669         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
49670         *ret_conv = ShutdownScript_read(ser_ref);
49671         FREE(ser);
49672         return tag_ptr(ret_conv, true);
49673 }
49674
49675 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
49676         uint8_t pubkey_hash_arr[20];
49677         CHECK(pubkey_hash->arr_len == 20);
49678         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
49679         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
49680         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
49681         uint64_t ret_ref = 0;
49682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49684         return ret_ref;
49685 }
49686
49687 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
49688         uint8_t script_hash_arr[32];
49689         CHECK(script_hash->arr_len == 32);
49690         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
49691         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
49692         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
49693         uint64_t ret_ref = 0;
49694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49696         return ret_ref;
49697 }
49698
49699 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
49700         
49701         LDKu8slice program_ref;
49702         program_ref.datalen = program->arr_len;
49703         program_ref.data = program->elems;
49704         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
49705         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
49706         FREE(program);
49707         return tag_ptr(ret_conv, true);
49708 }
49709
49710 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
49711         LDKShutdownScript this_arg_conv;
49712         this_arg_conv.inner = untag_ptr(this_arg);
49713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49715         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
49716         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
49717         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49718         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49719         CVec_u8Z_free(ret_var);
49720         return ret_arr;
49721 }
49722
49723 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
49724         LDKShutdownScript this_arg_conv;
49725         this_arg_conv.inner = untag_ptr(this_arg);
49726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49728         this_arg_conv.is_owned = false;
49729         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49730         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
49731         return ret_arr;
49732 }
49733
49734 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
49735         LDKShutdownScript this_arg_conv;
49736         this_arg_conv.inner = untag_ptr(this_arg);
49737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49739         this_arg_conv.is_owned = false;
49740         LDKInitFeatures features_conv;
49741         features_conv.inner = untag_ptr(features);
49742         features_conv.is_owned = ptr_is_owned(features);
49743         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
49744         features_conv.is_owned = false;
49745         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
49746         return ret_conv;
49747 }
49748
49749 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
49750         if (!ptr_is_owned(this_ptr)) return;
49751         void* this_ptr_ptr = untag_ptr(this_ptr);
49752         CHECK_ACCESS(this_ptr_ptr);
49753         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
49754         FREE(untag_ptr(this_ptr));
49755         Retry_free(this_ptr_conv);
49756 }
49757
49758 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
49759         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49760         *ret_copy = Retry_clone(arg);
49761         uint64_t ret_ref = tag_ptr(ret_copy, true);
49762         return ret_ref;
49763 }
49764 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
49765         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
49766         int64_t ret_conv = Retry_clone_ptr(arg_conv);
49767         return ret_conv;
49768 }
49769
49770 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
49771         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
49772         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49773         *ret_copy = Retry_clone(orig_conv);
49774         uint64_t ret_ref = tag_ptr(ret_copy, true);
49775         return ret_ref;
49776 }
49777
49778 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
49779         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49780         *ret_copy = Retry_attempts(a);
49781         uint64_t ret_ref = tag_ptr(ret_copy, true);
49782         return ret_ref;
49783 }
49784
49785 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
49786         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
49787         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
49788         jboolean ret_conv = Retry_eq(a_conv, b_conv);
49789         return ret_conv;
49790 }
49791
49792 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
49793         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
49794         int64_t ret_conv = Retry_hash(o_conv);
49795         return ret_conv;
49796 }
49797
49798 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
49799         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
49800         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
49801         return ret_conv;
49802 }
49803
49804 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
49805         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
49806         return ret_conv;
49807 }
49808
49809 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
49810         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
49811         return ret_conv;
49812 }
49813
49814 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
49815         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
49816         return ret_conv;
49817 }
49818
49819 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
49820         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
49821         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
49822         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
49823         return ret_conv;
49824 }
49825
49826 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
49827         if (!ptr_is_owned(this_ptr)) return;
49828         void* this_ptr_ptr = untag_ptr(this_ptr);
49829         CHECK_ACCESS(this_ptr_ptr);
49830         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
49831         FREE(untag_ptr(this_ptr));
49832         PaymentSendFailure_free(this_ptr_conv);
49833 }
49834
49835 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
49836         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49837         *ret_copy = PaymentSendFailure_clone(arg);
49838         uint64_t ret_ref = tag_ptr(ret_copy, true);
49839         return ret_ref;
49840 }
49841 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
49842         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
49843         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
49844         return ret_conv;
49845 }
49846
49847 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
49848         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
49849         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49850         *ret_copy = PaymentSendFailure_clone(orig_conv);
49851         uint64_t ret_ref = tag_ptr(ret_copy, true);
49852         return ret_ref;
49853 }
49854
49855 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
49856         void* a_ptr = untag_ptr(a);
49857         CHECK_ACCESS(a_ptr);
49858         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
49859         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
49860         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49861         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
49862         uint64_t ret_ref = tag_ptr(ret_copy, true);
49863         return ret_ref;
49864 }
49865
49866 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
49867         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
49868         a_constr.datalen = a->arr_len;
49869         if (a_constr.datalen > 0)
49870                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
49871         else
49872                 a_constr.data = NULL;
49873         uint64_t* a_vals = a->elems;
49874         for (size_t w = 0; w < a_constr.datalen; w++) {
49875                 uint64_t a_conv_22 = a_vals[w];
49876                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
49877                 CHECK_ACCESS(a_conv_22_ptr);
49878                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
49879                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
49880                 a_constr.data[w] = a_conv_22_conv;
49881         }
49882         FREE(a);
49883         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49884         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
49885         uint64_t ret_ref = tag_ptr(ret_copy, true);
49886         return ret_ref;
49887 }
49888
49889 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
49890         LDKCVec_APIErrorZ a_constr;
49891         a_constr.datalen = a->arr_len;
49892         if (a_constr.datalen > 0)
49893                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
49894         else
49895                 a_constr.data = NULL;
49896         uint64_t* a_vals = a->elems;
49897         for (size_t k = 0; k < a_constr.datalen; k++) {
49898                 uint64_t a_conv_10 = a_vals[k];
49899                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
49900                 CHECK_ACCESS(a_conv_10_ptr);
49901                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
49902                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
49903                 a_constr.data[k] = a_conv_10_conv;
49904         }
49905         FREE(a);
49906         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49907         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
49908         uint64_t ret_ref = tag_ptr(ret_copy, true);
49909         return ret_ref;
49910 }
49911
49912 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
49913         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49914         *ret_copy = PaymentSendFailure_duplicate_payment();
49915         uint64_t ret_ref = tag_ptr(ret_copy, true);
49916         return ret_ref;
49917 }
49918
49919 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) {
49920         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
49921         results_constr.datalen = results->arr_len;
49922         if (results_constr.datalen > 0)
49923                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
49924         else
49925                 results_constr.data = NULL;
49926         uint64_t* results_vals = results->elems;
49927         for (size_t w = 0; w < results_constr.datalen; w++) {
49928                 uint64_t results_conv_22 = results_vals[w];
49929                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
49930                 CHECK_ACCESS(results_conv_22_ptr);
49931                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
49932                 results_constr.data[w] = results_conv_22_conv;
49933         }
49934         FREE(results);
49935         LDKRouteParameters failed_paths_retry_conv;
49936         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
49937         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
49938         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
49939         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
49940         LDKThirtyTwoBytes payment_id_ref;
49941         CHECK(payment_id->arr_len == 32);
49942         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49943         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49944         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
49945         uint64_t ret_ref = tag_ptr(ret_copy, true);
49946         return ret_ref;
49947 }
49948
49949 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
49950         LDKRecipientOnionFields this_obj_conv;
49951         this_obj_conv.inner = untag_ptr(this_obj);
49952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49954         RecipientOnionFields_free(this_obj_conv);
49955 }
49956
49957 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
49958         LDKRecipientOnionFields this_ptr_conv;
49959         this_ptr_conv.inner = untag_ptr(this_ptr);
49960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49962         this_ptr_conv.is_owned = false;
49963         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
49964         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
49965         uint64_t ret_ref = tag_ptr(ret_copy, true);
49966         return ret_ref;
49967 }
49968
49969 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
49970         LDKRecipientOnionFields this_ptr_conv;
49971         this_ptr_conv.inner = untag_ptr(this_ptr);
49972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49974         this_ptr_conv.is_owned = false;
49975         void* val_ptr = untag_ptr(val);
49976         CHECK_ACCESS(val_ptr);
49977         LDKCOption_PaymentSecretZ val_conv = *(LDKCOption_PaymentSecretZ*)(val_ptr);
49978         val_conv = COption_PaymentSecretZ_clone((LDKCOption_PaymentSecretZ*)untag_ptr(val));
49979         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
49980 }
49981
49982 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
49983         LDKRecipientOnionFields this_ptr_conv;
49984         this_ptr_conv.inner = untag_ptr(this_ptr);
49985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49987         this_ptr_conv.is_owned = false;
49988         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
49989         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
49990         uint64_t ret_ref = tag_ptr(ret_copy, true);
49991         return ret_ref;
49992 }
49993
49994 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
49995         LDKRecipientOnionFields this_ptr_conv;
49996         this_ptr_conv.inner = untag_ptr(this_ptr);
49997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49999         this_ptr_conv.is_owned = false;
50000         void* val_ptr = untag_ptr(val);
50001         CHECK_ACCESS(val_ptr);
50002         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
50003         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
50004         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
50005 }
50006
50007 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_new"))) TS_RecipientOnionFields_new(uint64_t payment_secret_arg, uint64_t payment_metadata_arg) {
50008         void* payment_secret_arg_ptr = untag_ptr(payment_secret_arg);
50009         CHECK_ACCESS(payment_secret_arg_ptr);
50010         LDKCOption_PaymentSecretZ payment_secret_arg_conv = *(LDKCOption_PaymentSecretZ*)(payment_secret_arg_ptr);
50011         payment_secret_arg_conv = COption_PaymentSecretZ_clone((LDKCOption_PaymentSecretZ*)untag_ptr(payment_secret_arg));
50012         void* payment_metadata_arg_ptr = untag_ptr(payment_metadata_arg);
50013         CHECK_ACCESS(payment_metadata_arg_ptr);
50014         LDKCOption_CVec_u8ZZ payment_metadata_arg_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_arg_ptr);
50015         payment_metadata_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata_arg));
50016         LDKRecipientOnionFields ret_var = RecipientOnionFields_new(payment_secret_arg_conv, payment_metadata_arg_conv);
50017         uint64_t ret_ref = 0;
50018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50020         return ret_ref;
50021 }
50022
50023 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
50024         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
50025         uint64_t ret_ref = 0;
50026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50028         return ret_ref;
50029 }
50030 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
50031         LDKRecipientOnionFields arg_conv;
50032         arg_conv.inner = untag_ptr(arg);
50033         arg_conv.is_owned = ptr_is_owned(arg);
50034         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50035         arg_conv.is_owned = false;
50036         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
50037         return ret_conv;
50038 }
50039
50040 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
50041         LDKRecipientOnionFields orig_conv;
50042         orig_conv.inner = untag_ptr(orig);
50043         orig_conv.is_owned = ptr_is_owned(orig);
50044         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50045         orig_conv.is_owned = false;
50046         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
50047         uint64_t ret_ref = 0;
50048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50050         return ret_ref;
50051 }
50052
50053 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
50054         LDKRecipientOnionFields a_conv;
50055         a_conv.inner = untag_ptr(a);
50056         a_conv.is_owned = ptr_is_owned(a);
50057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50058         a_conv.is_owned = false;
50059         LDKRecipientOnionFields b_conv;
50060         b_conv.inner = untag_ptr(b);
50061         b_conv.is_owned = ptr_is_owned(b);
50062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50063         b_conv.is_owned = false;
50064         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
50065         return ret_conv;
50066 }
50067
50068 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
50069         LDKRecipientOnionFields obj_conv;
50070         obj_conv.inner = untag_ptr(obj);
50071         obj_conv.is_owned = ptr_is_owned(obj);
50072         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50073         obj_conv.is_owned = false;
50074         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
50075         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50076         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50077         CVec_u8Z_free(ret_var);
50078         return ret_arr;
50079 }
50080
50081 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
50082         LDKu8slice ser_ref;
50083         ser_ref.datalen = ser->arr_len;
50084         ser_ref.data = ser->elems;
50085         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
50086         *ret_conv = RecipientOnionFields_read(ser_ref);
50087         FREE(ser);
50088         return tag_ptr(ret_conv, true);
50089 }
50090
50091 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
50092         LDKThirtyTwoBytes payment_secret_ref;
50093         CHECK(payment_secret->arr_len == 32);
50094         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
50095         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
50096         uint64_t ret_ref = 0;
50097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50099         return ret_ref;
50100 }
50101
50102 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
50103         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
50104         uint64_t ret_ref = 0;
50105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50107         return ret_ref;
50108 }
50109
50110 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
50111         if (!ptr_is_owned(this_ptr)) return;
50112         void* this_ptr_ptr = untag_ptr(this_ptr);
50113         CHECK_ACCESS(this_ptr_ptr);
50114         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
50115         FREE(untag_ptr(this_ptr));
50116         CustomMessageReader_free(this_ptr_conv);
50117 }
50118
50119 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
50120         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
50121         *ret_ret = Type_clone(arg);
50122         return tag_ptr(ret_ret, true);
50123 }
50124 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
50125         void* arg_ptr = untag_ptr(arg);
50126         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
50127         LDKType* arg_conv = (LDKType*)arg_ptr;
50128         int64_t ret_conv = Type_clone_ptr(arg_conv);
50129         return ret_conv;
50130 }
50131
50132 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
50133         void* orig_ptr = untag_ptr(orig);
50134         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
50135         LDKType* orig_conv = (LDKType*)orig_ptr;
50136         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
50137         *ret_ret = Type_clone(orig_conv);
50138         return tag_ptr(ret_ret, true);
50139 }
50140
50141 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
50142         if (!ptr_is_owned(this_ptr)) return;
50143         void* this_ptr_ptr = untag_ptr(this_ptr);
50144         CHECK_ACCESS(this_ptr_ptr);
50145         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
50146         FREE(untag_ptr(this_ptr));
50147         Type_free(this_ptr_conv);
50148 }
50149
50150 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
50151         LDKUnsignedBolt12Invoice this_obj_conv;
50152         this_obj_conv.inner = untag_ptr(this_obj);
50153         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50155         UnsignedBolt12Invoice_free(this_obj_conv);
50156 }
50157
50158 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
50159         LDKUnsignedBolt12Invoice this_arg_conv;
50160         this_arg_conv.inner = untag_ptr(this_arg);
50161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50163         this_arg_conv.is_owned = false;
50164         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50165         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
50166         return ret_arr;
50167 }
50168
50169 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
50170         LDKBolt12Invoice this_obj_conv;
50171         this_obj_conv.inner = untag_ptr(this_obj);
50172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50174         Bolt12Invoice_free(this_obj_conv);
50175 }
50176
50177 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
50178         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
50179         uint64_t ret_ref = 0;
50180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50182         return ret_ref;
50183 }
50184 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
50185         LDKBolt12Invoice arg_conv;
50186         arg_conv.inner = untag_ptr(arg);
50187         arg_conv.is_owned = ptr_is_owned(arg);
50188         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50189         arg_conv.is_owned = false;
50190         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
50191         return ret_conv;
50192 }
50193
50194 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
50195         LDKBolt12Invoice orig_conv;
50196         orig_conv.inner = untag_ptr(orig);
50197         orig_conv.is_owned = ptr_is_owned(orig);
50198         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50199         orig_conv.is_owned = false;
50200         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
50201         uint64_t ret_ref = 0;
50202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50204         return ret_ref;
50205 }
50206
50207 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
50208         LDKBolt12Invoice this_arg_conv;
50209         this_arg_conv.inner = untag_ptr(this_arg);
50210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50212         this_arg_conv.is_owned = false;
50213         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
50214         uint64_t ret_ref = 0;
50215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50217         return ret_ref;
50218 }
50219
50220 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
50221         LDKBolt12Invoice this_arg_conv;
50222         this_arg_conv.inner = untag_ptr(this_arg);
50223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50225         this_arg_conv.is_owned = false;
50226         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
50227         return ret_conv;
50228 }
50229
50230 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
50231         LDKBolt12Invoice this_arg_conv;
50232         this_arg_conv.inner = untag_ptr(this_arg);
50233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50235         this_arg_conv.is_owned = false;
50236         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
50237         return ret_conv;
50238 }
50239
50240 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
50241         LDKBolt12Invoice this_arg_conv;
50242         this_arg_conv.inner = untag_ptr(this_arg);
50243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50245         this_arg_conv.is_owned = false;
50246         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50247         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
50248         return ret_arr;
50249 }
50250
50251 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
50252         LDKBolt12Invoice this_arg_conv;
50253         this_arg_conv.inner = untag_ptr(this_arg);
50254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50256         this_arg_conv.is_owned = false;
50257         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
50258         return ret_conv;
50259 }
50260
50261 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_features"))) TS_Bolt12Invoice_features(uint64_t this_arg) {
50262         LDKBolt12Invoice this_arg_conv;
50263         this_arg_conv.inner = untag_ptr(this_arg);
50264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50266         this_arg_conv.is_owned = false;
50267         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_features(&this_arg_conv);
50268         uint64_t ret_ref = 0;
50269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50271         return ret_ref;
50272 }
50273
50274 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
50275         LDKBolt12Invoice this_arg_conv;
50276         this_arg_conv.inner = untag_ptr(this_arg);
50277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50279         this_arg_conv.is_owned = false;
50280         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50281         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
50282         return ret_arr;
50283 }
50284
50285 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
50286         LDKBolt12Invoice this_arg_conv;
50287         this_arg_conv.inner = untag_ptr(this_arg);
50288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50290         this_arg_conv.is_owned = false;
50291         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50292         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
50293         return ret_arr;
50294 }
50295
50296 jboolean  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
50297         LDKBolt12Invoice this_arg_conv;
50298         this_arg_conv.inner = untag_ptr(this_arg);
50299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50301         this_arg_conv.is_owned = false;
50302         LDKExpandedKey key_conv;
50303         key_conv.inner = untag_ptr(key);
50304         key_conv.is_owned = ptr_is_owned(key);
50305         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
50306         key_conv.is_owned = false;
50307         jboolean ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
50308         return ret_conv;
50309 }
50310
50311 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
50312         LDKBolt12Invoice obj_conv;
50313         obj_conv.inner = untag_ptr(obj);
50314         obj_conv.is_owned = ptr_is_owned(obj);
50315         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50316         obj_conv.is_owned = false;
50317         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
50318         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50319         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50320         CVec_u8Z_free(ret_var);
50321         return ret_arr;
50322 }
50323
50324 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
50325         LDKBlindedPayInfo this_obj_conv;
50326         this_obj_conv.inner = untag_ptr(this_obj);
50327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50329         BlindedPayInfo_free(this_obj_conv);
50330 }
50331
50332 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
50333         LDKBlindedPayInfo this_ptr_conv;
50334         this_ptr_conv.inner = untag_ptr(this_ptr);
50335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50337         this_ptr_conv.is_owned = false;
50338         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
50339         return ret_conv;
50340 }
50341
50342 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
50343         LDKBlindedPayInfo this_ptr_conv;
50344         this_ptr_conv.inner = untag_ptr(this_ptr);
50345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50347         this_ptr_conv.is_owned = false;
50348         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
50349 }
50350
50351 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
50352         LDKBlindedPayInfo this_ptr_conv;
50353         this_ptr_conv.inner = untag_ptr(this_ptr);
50354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50356         this_ptr_conv.is_owned = false;
50357         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
50358         return ret_conv;
50359 }
50360
50361 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
50362         LDKBlindedPayInfo this_ptr_conv;
50363         this_ptr_conv.inner = untag_ptr(this_ptr);
50364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50366         this_ptr_conv.is_owned = false;
50367         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
50368 }
50369
50370 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
50371         LDKBlindedPayInfo this_ptr_conv;
50372         this_ptr_conv.inner = untag_ptr(this_ptr);
50373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50375         this_ptr_conv.is_owned = false;
50376         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
50377         return ret_conv;
50378 }
50379
50380 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
50381         LDKBlindedPayInfo this_ptr_conv;
50382         this_ptr_conv.inner = untag_ptr(this_ptr);
50383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50385         this_ptr_conv.is_owned = false;
50386         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
50387 }
50388
50389 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
50390         LDKBlindedPayInfo this_ptr_conv;
50391         this_ptr_conv.inner = untag_ptr(this_ptr);
50392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50394         this_ptr_conv.is_owned = false;
50395         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
50396         return ret_conv;
50397 }
50398
50399 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
50400         LDKBlindedPayInfo this_ptr_conv;
50401         this_ptr_conv.inner = untag_ptr(this_ptr);
50402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50404         this_ptr_conv.is_owned = false;
50405         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
50406 }
50407
50408 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
50409         LDKBlindedPayInfo this_ptr_conv;
50410         this_ptr_conv.inner = untag_ptr(this_ptr);
50411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50413         this_ptr_conv.is_owned = false;
50414         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
50415         return ret_conv;
50416 }
50417
50418 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
50419         LDKBlindedPayInfo this_ptr_conv;
50420         this_ptr_conv.inner = untag_ptr(this_ptr);
50421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50423         this_ptr_conv.is_owned = false;
50424         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
50425 }
50426
50427 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
50428         LDKBlindedPayInfo this_ptr_conv;
50429         this_ptr_conv.inner = untag_ptr(this_ptr);
50430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50432         this_ptr_conv.is_owned = false;
50433         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
50434         uint64_t ret_ref = 0;
50435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50437         return ret_ref;
50438 }
50439
50440 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
50441         LDKBlindedPayInfo this_ptr_conv;
50442         this_ptr_conv.inner = untag_ptr(this_ptr);
50443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50445         this_ptr_conv.is_owned = false;
50446         LDKBlindedHopFeatures val_conv;
50447         val_conv.inner = untag_ptr(val);
50448         val_conv.is_owned = ptr_is_owned(val);
50449         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50450         val_conv = BlindedHopFeatures_clone(&val_conv);
50451         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
50452 }
50453
50454 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) {
50455         LDKBlindedHopFeatures features_arg_conv;
50456         features_arg_conv.inner = untag_ptr(features_arg);
50457         features_arg_conv.is_owned = ptr_is_owned(features_arg);
50458         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
50459         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
50460         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);
50461         uint64_t ret_ref = 0;
50462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50464         return ret_ref;
50465 }
50466
50467 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
50468         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
50469         uint64_t ret_ref = 0;
50470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50472         return ret_ref;
50473 }
50474 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
50475         LDKBlindedPayInfo arg_conv;
50476         arg_conv.inner = untag_ptr(arg);
50477         arg_conv.is_owned = ptr_is_owned(arg);
50478         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50479         arg_conv.is_owned = false;
50480         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
50481         return ret_conv;
50482 }
50483
50484 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
50485         LDKBlindedPayInfo orig_conv;
50486         orig_conv.inner = untag_ptr(orig);
50487         orig_conv.is_owned = ptr_is_owned(orig);
50488         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50489         orig_conv.is_owned = false;
50490         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
50491         uint64_t ret_ref = 0;
50492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50494         return ret_ref;
50495 }
50496
50497 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
50498         LDKBlindedPayInfo o_conv;
50499         o_conv.inner = untag_ptr(o);
50500         o_conv.is_owned = ptr_is_owned(o);
50501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50502         o_conv.is_owned = false;
50503         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
50504         return ret_conv;
50505 }
50506
50507 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
50508         LDKBlindedPayInfo a_conv;
50509         a_conv.inner = untag_ptr(a);
50510         a_conv.is_owned = ptr_is_owned(a);
50511         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50512         a_conv.is_owned = false;
50513         LDKBlindedPayInfo b_conv;
50514         b_conv.inner = untag_ptr(b);
50515         b_conv.is_owned = ptr_is_owned(b);
50516         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50517         b_conv.is_owned = false;
50518         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
50519         return ret_conv;
50520 }
50521
50522 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
50523         LDKBlindedPayInfo obj_conv;
50524         obj_conv.inner = untag_ptr(obj);
50525         obj_conv.is_owned = ptr_is_owned(obj);
50526         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50527         obj_conv.is_owned = false;
50528         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
50529         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50530         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50531         CVec_u8Z_free(ret_var);
50532         return ret_arr;
50533 }
50534
50535 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
50536         LDKu8slice ser_ref;
50537         ser_ref.datalen = ser->arr_len;
50538         ser_ref.data = ser->elems;
50539         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
50540         *ret_conv = BlindedPayInfo_read(ser_ref);
50541         FREE(ser);
50542         return tag_ptr(ret_conv, true);
50543 }
50544
50545 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
50546         LDKInvoiceError this_obj_conv;
50547         this_obj_conv.inner = untag_ptr(this_obj);
50548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50550         InvoiceError_free(this_obj_conv);
50551 }
50552
50553 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
50554         LDKInvoiceError this_ptr_conv;
50555         this_ptr_conv.inner = untag_ptr(this_ptr);
50556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50558         this_ptr_conv.is_owned = false;
50559         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
50560         uint64_t ret_ref = 0;
50561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50563         return ret_ref;
50564 }
50565
50566 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
50567         LDKInvoiceError this_ptr_conv;
50568         this_ptr_conv.inner = untag_ptr(this_ptr);
50569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50571         this_ptr_conv.is_owned = false;
50572         LDKErroneousField val_conv;
50573         val_conv.inner = untag_ptr(val);
50574         val_conv.is_owned = ptr_is_owned(val);
50575         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50576         val_conv = ErroneousField_clone(&val_conv);
50577         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
50578 }
50579
50580 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
50581         LDKInvoiceError this_ptr_conv;
50582         this_ptr_conv.inner = untag_ptr(this_ptr);
50583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50585         this_ptr_conv.is_owned = false;
50586         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
50587         uint64_t ret_ref = 0;
50588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50590         return ret_ref;
50591 }
50592
50593 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
50594         LDKInvoiceError this_ptr_conv;
50595         this_ptr_conv.inner = untag_ptr(this_ptr);
50596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50598         this_ptr_conv.is_owned = false;
50599         LDKUntrustedString val_conv;
50600         val_conv.inner = untag_ptr(val);
50601         val_conv.is_owned = ptr_is_owned(val);
50602         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50603         val_conv = UntrustedString_clone(&val_conv);
50604         InvoiceError_set_message(&this_ptr_conv, val_conv);
50605 }
50606
50607 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
50608         LDKErroneousField erroneous_field_arg_conv;
50609         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
50610         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
50611         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
50612         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
50613         LDKUntrustedString message_arg_conv;
50614         message_arg_conv.inner = untag_ptr(message_arg);
50615         message_arg_conv.is_owned = ptr_is_owned(message_arg);
50616         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
50617         message_arg_conv = UntrustedString_clone(&message_arg_conv);
50618         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
50619         uint64_t ret_ref = 0;
50620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50622         return ret_ref;
50623 }
50624
50625 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
50626         LDKInvoiceError ret_var = InvoiceError_clone(arg);
50627         uint64_t ret_ref = 0;
50628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50630         return ret_ref;
50631 }
50632 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
50633         LDKInvoiceError arg_conv;
50634         arg_conv.inner = untag_ptr(arg);
50635         arg_conv.is_owned = ptr_is_owned(arg);
50636         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50637         arg_conv.is_owned = false;
50638         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
50639         return ret_conv;
50640 }
50641
50642 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
50643         LDKInvoiceError orig_conv;
50644         orig_conv.inner = untag_ptr(orig);
50645         orig_conv.is_owned = ptr_is_owned(orig);
50646         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50647         orig_conv.is_owned = false;
50648         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
50649         uint64_t ret_ref = 0;
50650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50652         return ret_ref;
50653 }
50654
50655 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
50656         LDKErroneousField this_obj_conv;
50657         this_obj_conv.inner = untag_ptr(this_obj);
50658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50660         ErroneousField_free(this_obj_conv);
50661 }
50662
50663 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
50664         LDKErroneousField this_ptr_conv;
50665         this_ptr_conv.inner = untag_ptr(this_ptr);
50666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50668         this_ptr_conv.is_owned = false;
50669         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
50670         return ret_conv;
50671 }
50672
50673 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
50674         LDKErroneousField this_ptr_conv;
50675         this_ptr_conv.inner = untag_ptr(this_ptr);
50676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50678         this_ptr_conv.is_owned = false;
50679         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
50680 }
50681
50682 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
50683         LDKErroneousField this_ptr_conv;
50684         this_ptr_conv.inner = untag_ptr(this_ptr);
50685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50687         this_ptr_conv.is_owned = false;
50688         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
50689         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
50690         uint64_t ret_ref = tag_ptr(ret_copy, true);
50691         return ret_ref;
50692 }
50693
50694 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
50695         LDKErroneousField this_ptr_conv;
50696         this_ptr_conv.inner = untag_ptr(this_ptr);
50697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50699         this_ptr_conv.is_owned = false;
50700         void* val_ptr = untag_ptr(val);
50701         CHECK_ACCESS(val_ptr);
50702         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
50703         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
50704         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
50705 }
50706
50707 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
50708         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
50709         CHECK_ACCESS(suggested_value_arg_ptr);
50710         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
50711         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
50712         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
50713         uint64_t ret_ref = 0;
50714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50716         return ret_ref;
50717 }
50718
50719 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
50720         LDKErroneousField ret_var = ErroneousField_clone(arg);
50721         uint64_t ret_ref = 0;
50722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50724         return ret_ref;
50725 }
50726 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
50727         LDKErroneousField arg_conv;
50728         arg_conv.inner = untag_ptr(arg);
50729         arg_conv.is_owned = ptr_is_owned(arg);
50730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50731         arg_conv.is_owned = false;
50732         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
50733         return ret_conv;
50734 }
50735
50736 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
50737         LDKErroneousField orig_conv;
50738         orig_conv.inner = untag_ptr(orig);
50739         orig_conv.is_owned = ptr_is_owned(orig);
50740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50741         orig_conv.is_owned = false;
50742         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
50743         uint64_t ret_ref = 0;
50744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50746         return ret_ref;
50747 }
50748
50749 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
50750         LDKInvoiceError obj_conv;
50751         obj_conv.inner = untag_ptr(obj);
50752         obj_conv.is_owned = ptr_is_owned(obj);
50753         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50754         obj_conv.is_owned = false;
50755         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
50756         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50757         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50758         CVec_u8Z_free(ret_var);
50759         return ret_arr;
50760 }
50761
50762 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
50763         LDKu8slice ser_ref;
50764         ser_ref.datalen = ser->arr_len;
50765         ser_ref.data = ser->elems;
50766         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
50767         *ret_conv = InvoiceError_read(ser_ref);
50768         FREE(ser);
50769         return tag_ptr(ret_conv, true);
50770 }
50771
50772 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
50773         LDKUnsignedInvoiceRequest this_obj_conv;
50774         this_obj_conv.inner = untag_ptr(this_obj);
50775         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50777         UnsignedInvoiceRequest_free(this_obj_conv);
50778 }
50779
50780 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
50781         LDKInvoiceRequest this_obj_conv;
50782         this_obj_conv.inner = untag_ptr(this_obj);
50783         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50785         InvoiceRequest_free(this_obj_conv);
50786 }
50787
50788 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
50789         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
50790         uint64_t ret_ref = 0;
50791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50793         return ret_ref;
50794 }
50795 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
50796         LDKInvoiceRequest arg_conv;
50797         arg_conv.inner = untag_ptr(arg);
50798         arg_conv.is_owned = ptr_is_owned(arg);
50799         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50800         arg_conv.is_owned = false;
50801         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
50802         return ret_conv;
50803 }
50804
50805 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
50806         LDKInvoiceRequest orig_conv;
50807         orig_conv.inner = untag_ptr(orig);
50808         orig_conv.is_owned = ptr_is_owned(orig);
50809         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50810         orig_conv.is_owned = false;
50811         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
50812         uint64_t ret_ref = 0;
50813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50815         return ret_ref;
50816 }
50817
50818 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
50819         LDKInvoiceRequest this_arg_conv;
50820         this_arg_conv.inner = untag_ptr(this_arg);
50821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50823         this_arg_conv.is_owned = false;
50824         LDKu8slice ret_var = InvoiceRequest_metadata(&this_arg_conv);
50825         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50826         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50827         return ret_arr;
50828 }
50829
50830 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
50831         LDKInvoiceRequest this_arg_conv;
50832         this_arg_conv.inner = untag_ptr(this_arg);
50833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50835         this_arg_conv.is_owned = false;
50836         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50837         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
50838         return ret_arr;
50839 }
50840
50841 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
50842         LDKInvoiceRequest this_arg_conv;
50843         this_arg_conv.inner = untag_ptr(this_arg);
50844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50846         this_arg_conv.is_owned = false;
50847         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50848         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
50849         uint64_t ret_ref = tag_ptr(ret_copy, true);
50850         return ret_ref;
50851 }
50852
50853 uint64_t  __attribute__((export_name("TS_InvoiceRequest_features"))) TS_InvoiceRequest_features(uint64_t this_arg) {
50854         LDKInvoiceRequest this_arg_conv;
50855         this_arg_conv.inner = untag_ptr(this_arg);
50856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50858         this_arg_conv.is_owned = false;
50859         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_features(&this_arg_conv);
50860         uint64_t ret_ref = 0;
50861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50863         return ret_ref;
50864 }
50865
50866 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
50867         LDKInvoiceRequest this_arg_conv;
50868         this_arg_conv.inner = untag_ptr(this_arg);
50869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50871         this_arg_conv.is_owned = false;
50872         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50873         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
50874         uint64_t ret_ref = tag_ptr(ret_copy, true);
50875         return ret_ref;
50876 }
50877
50878 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
50879         LDKInvoiceRequest this_arg_conv;
50880         this_arg_conv.inner = untag_ptr(this_arg);
50881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50883         this_arg_conv.is_owned = false;
50884         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50885         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
50886         return ret_arr;
50887 }
50888
50889 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
50890         LDKInvoiceRequest this_arg_conv;
50891         this_arg_conv.inner = untag_ptr(this_arg);
50892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50894         this_arg_conv.is_owned = false;
50895         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
50896         uint64_t ret_ref = 0;
50897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50899         return ret_ref;
50900 }
50901
50902 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
50903         LDKInvoiceRequest this_arg_conv;
50904         this_arg_conv.inner = untag_ptr(this_arg);
50905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50907         this_arg_conv.is_owned = false;
50908         LDKExpandedKey key_conv;
50909         key_conv.inner = untag_ptr(key);
50910         key_conv.is_owned = ptr_is_owned(key);
50911         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
50912         key_conv.is_owned = false;
50913         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
50914         *ret_conv = InvoiceRequest_verify(&this_arg_conv, &key_conv);
50915         return tag_ptr(ret_conv, true);
50916 }
50917
50918 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
50919         LDKInvoiceRequest obj_conv;
50920         obj_conv.inner = untag_ptr(obj);
50921         obj_conv.is_owned = ptr_is_owned(obj);
50922         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50923         obj_conv.is_owned = false;
50924         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
50925         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50926         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50927         CVec_u8Z_free(ret_var);
50928         return ret_arr;
50929 }
50930
50931 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
50932         LDKOffer this_obj_conv;
50933         this_obj_conv.inner = untag_ptr(this_obj);
50934         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50936         Offer_free(this_obj_conv);
50937 }
50938
50939 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
50940         LDKOffer ret_var = Offer_clone(arg);
50941         uint64_t ret_ref = 0;
50942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50944         return ret_ref;
50945 }
50946 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
50947         LDKOffer arg_conv;
50948         arg_conv.inner = untag_ptr(arg);
50949         arg_conv.is_owned = ptr_is_owned(arg);
50950         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50951         arg_conv.is_owned = false;
50952         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
50953         return ret_conv;
50954 }
50955
50956 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
50957         LDKOffer orig_conv;
50958         orig_conv.inner = untag_ptr(orig);
50959         orig_conv.is_owned = ptr_is_owned(orig);
50960         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50961         orig_conv.is_owned = false;
50962         LDKOffer ret_var = Offer_clone(&orig_conv);
50963         uint64_t ret_ref = 0;
50964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50966         return ret_ref;
50967 }
50968
50969 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
50970         LDKOffer this_arg_conv;
50971         this_arg_conv.inner = untag_ptr(this_arg);
50972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50974         this_arg_conv.is_owned = false;
50975         LDKCVec_ChainHashZ ret_var = Offer_chains(&this_arg_conv);
50976         ptrArray ret_arr = NULL;
50977         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
50978         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
50979         for (size_t m = 0; m < ret_var.datalen; m++) {
50980                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
50981                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
50982                 ret_arr_ptr[m] = ret_conv_12_arr;
50983         }
50984         
50985         FREE(ret_var.data);
50986         return ret_arr;
50987 }
50988
50989 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
50990         LDKOffer this_arg_conv;
50991         this_arg_conv.inner = untag_ptr(this_arg);
50992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50994         this_arg_conv.is_owned = false;
50995         LDKThirtyTwoBytes chain_ref;
50996         CHECK(chain->arr_len == 32);
50997         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
50998         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
50999         return ret_conv;
51000 }
51001
51002 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
51003         LDKOffer this_arg_conv;
51004         this_arg_conv.inner = untag_ptr(this_arg);
51005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51007         this_arg_conv.is_owned = false;
51008         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
51009         *ret_copy = Offer_metadata(&this_arg_conv);
51010         uint64_t ret_ref = tag_ptr(ret_copy, true);
51011         return ret_ref;
51012 }
51013
51014 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
51015         LDKOffer this_arg_conv;
51016         this_arg_conv.inner = untag_ptr(this_arg);
51017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51019         this_arg_conv.is_owned = false;
51020         LDKAmount ret_var = Offer_amount(&this_arg_conv);
51021         uint64_t ret_ref = 0;
51022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51024         return ret_ref;
51025 }
51026
51027 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
51028         LDKOffer this_arg_conv;
51029         this_arg_conv.inner = untag_ptr(this_arg);
51030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51032         this_arg_conv.is_owned = false;
51033         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
51034         uint64_t ret_ref = 0;
51035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51037         return ret_ref;
51038 }
51039
51040 uint64_t  __attribute__((export_name("TS_Offer_features"))) TS_Offer_features(uint64_t this_arg) {
51041         LDKOffer this_arg_conv;
51042         this_arg_conv.inner = untag_ptr(this_arg);
51043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51045         this_arg_conv.is_owned = false;
51046         LDKOfferFeatures ret_var = Offer_features(&this_arg_conv);
51047         uint64_t ret_ref = 0;
51048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51050         return ret_ref;
51051 }
51052
51053 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
51054         LDKOffer this_arg_conv;
51055         this_arg_conv.inner = untag_ptr(this_arg);
51056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51058         this_arg_conv.is_owned = false;
51059         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
51060         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
51061         uint64_t ret_ref = tag_ptr(ret_copy, true);
51062         return ret_ref;
51063 }
51064
51065 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
51066         LDKOffer this_arg_conv;
51067         this_arg_conv.inner = untag_ptr(this_arg);
51068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51070         this_arg_conv.is_owned = false;
51071         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
51072         uint64_t ret_ref = 0;
51073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51075         return ret_ref;
51076 }
51077
51078 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
51079         LDKOffer this_arg_conv;
51080         this_arg_conv.inner = untag_ptr(this_arg);
51081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51083         this_arg_conv.is_owned = false;
51084         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
51085         uint64_tArray ret_arr = NULL;
51086         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
51087         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
51088         for (size_t n = 0; n < ret_var.datalen; n++) {
51089                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
51090                 uint64_t ret_conv_13_ref = 0;
51091                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
51092                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
51093                 ret_arr_ptr[n] = ret_conv_13_ref;
51094         }
51095         
51096         FREE(ret_var.data);
51097         return ret_arr;
51098 }
51099
51100 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
51101         LDKOffer this_arg_conv;
51102         this_arg_conv.inner = untag_ptr(this_arg);
51103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51105         this_arg_conv.is_owned = false;
51106         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
51107         uint64_t ret_ref = 0;
51108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51110         return ret_ref;
51111 }
51112
51113 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
51114         LDKOffer this_arg_conv;
51115         this_arg_conv.inner = untag_ptr(this_arg);
51116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51118         this_arg_conv.is_owned = false;
51119         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
51120         return ret_conv;
51121 }
51122
51123 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
51124         LDKOffer this_arg_conv;
51125         this_arg_conv.inner = untag_ptr(this_arg);
51126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51128         this_arg_conv.is_owned = false;
51129         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
51130         return ret_conv;
51131 }
51132
51133 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
51134         LDKOffer this_arg_conv;
51135         this_arg_conv.inner = untag_ptr(this_arg);
51136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51138         this_arg_conv.is_owned = false;
51139         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51140         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
51141         return ret_arr;
51142 }
51143
51144 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
51145         LDKOffer obj_conv;
51146         obj_conv.inner = untag_ptr(obj);
51147         obj_conv.is_owned = ptr_is_owned(obj);
51148         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51149         obj_conv.is_owned = false;
51150         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
51151         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51152         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51153         CVec_u8Z_free(ret_var);
51154         return ret_arr;
51155 }
51156
51157 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
51158         LDKAmount this_obj_conv;
51159         this_obj_conv.inner = untag_ptr(this_obj);
51160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51162         Amount_free(this_obj_conv);
51163 }
51164
51165 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
51166         LDKAmount ret_var = Amount_clone(arg);
51167         uint64_t ret_ref = 0;
51168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51170         return ret_ref;
51171 }
51172 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
51173         LDKAmount arg_conv;
51174         arg_conv.inner = untag_ptr(arg);
51175         arg_conv.is_owned = ptr_is_owned(arg);
51176         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51177         arg_conv.is_owned = false;
51178         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
51179         return ret_conv;
51180 }
51181
51182 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
51183         LDKAmount orig_conv;
51184         orig_conv.inner = untag_ptr(orig);
51185         orig_conv.is_owned = ptr_is_owned(orig);
51186         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51187         orig_conv.is_owned = false;
51188         LDKAmount ret_var = Amount_clone(&orig_conv);
51189         uint64_t ret_ref = 0;
51190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51192         return ret_ref;
51193 }
51194
51195 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
51196         LDKQuantity this_obj_conv;
51197         this_obj_conv.inner = untag_ptr(this_obj);
51198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51200         Quantity_free(this_obj_conv);
51201 }
51202
51203 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
51204         LDKQuantity ret_var = Quantity_clone(arg);
51205         uint64_t ret_ref = 0;
51206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51208         return ret_ref;
51209 }
51210 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
51211         LDKQuantity arg_conv;
51212         arg_conv.inner = untag_ptr(arg);
51213         arg_conv.is_owned = ptr_is_owned(arg);
51214         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51215         arg_conv.is_owned = false;
51216         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
51217         return ret_conv;
51218 }
51219
51220 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
51221         LDKQuantity orig_conv;
51222         orig_conv.inner = untag_ptr(orig);
51223         orig_conv.is_owned = ptr_is_owned(orig);
51224         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51225         orig_conv.is_owned = false;
51226         LDKQuantity ret_var = Quantity_clone(&orig_conv);
51227         uint64_t ret_ref = 0;
51228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51230         return ret_ref;
51231 }
51232
51233 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
51234         LDKStr s_conv = str_ref_to_owned_c(s);
51235         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
51236         *ret_conv = Offer_from_str(s_conv);
51237         return tag_ptr(ret_conv, true);
51238 }
51239
51240 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
51241         LDKBolt12ParseError this_obj_conv;
51242         this_obj_conv.inner = untag_ptr(this_obj);
51243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51245         Bolt12ParseError_free(this_obj_conv);
51246 }
51247
51248 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
51249         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
51250         uint64_t ret_ref = 0;
51251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51253         return ret_ref;
51254 }
51255 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
51256         LDKBolt12ParseError arg_conv;
51257         arg_conv.inner = untag_ptr(arg);
51258         arg_conv.is_owned = ptr_is_owned(arg);
51259         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51260         arg_conv.is_owned = false;
51261         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
51262         return ret_conv;
51263 }
51264
51265 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
51266         LDKBolt12ParseError orig_conv;
51267         orig_conv.inner = untag_ptr(orig);
51268         orig_conv.is_owned = ptr_is_owned(orig);
51269         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51270         orig_conv.is_owned = false;
51271         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
51272         uint64_t ret_ref = 0;
51273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51275         return ret_ref;
51276 }
51277
51278 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
51279         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
51280         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
51281         return ret_conv;
51282 }
51283
51284 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
51285         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
51286         return ret_conv;
51287 }
51288
51289 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
51290         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
51291         return ret_conv;
51292 }
51293
51294 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
51295         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
51296         return ret_conv;
51297 }
51298
51299 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
51300         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
51301         return ret_conv;
51302 }
51303
51304 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
51305         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
51306         return ret_conv;
51307 }
51308
51309 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
51310         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
51311         return ret_conv;
51312 }
51313
51314 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
51315         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
51316         return ret_conv;
51317 }
51318
51319 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
51320         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
51321         return ret_conv;
51322 }
51323
51324 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
51325         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
51326         return ret_conv;
51327 }
51328
51329 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
51330         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
51331         return ret_conv;
51332 }
51333
51334 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
51335         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
51336         return ret_conv;
51337 }
51338
51339 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
51340         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
51341         return ret_conv;
51342 }
51343
51344 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
51345         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
51346         return ret_conv;
51347 }
51348
51349 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
51350         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
51351         return ret_conv;
51352 }
51353
51354 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
51355         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
51356         return ret_conv;
51357 }
51358
51359 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
51360         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
51361         return ret_conv;
51362 }
51363
51364 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
51365         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
51366         return ret_conv;
51367 }
51368
51369 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
51370         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
51371         return ret_conv;
51372 }
51373
51374 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
51375         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
51376         return ret_conv;
51377 }
51378
51379 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
51380         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
51381         return ret_conv;
51382 }
51383
51384 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
51385         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
51386         return ret_conv;
51387 }
51388
51389 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
51390         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
51391         return ret_conv;
51392 }
51393
51394 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
51395         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
51396         return ret_conv;
51397 }
51398
51399 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
51400         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
51401         return ret_conv;
51402 }
51403
51404 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
51405         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
51406         return ret_conv;
51407 }
51408
51409 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
51410         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
51411         return ret_conv;
51412 }
51413
51414 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
51415         LDKRefund this_obj_conv;
51416         this_obj_conv.inner = untag_ptr(this_obj);
51417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51419         Refund_free(this_obj_conv);
51420 }
51421
51422 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
51423         LDKRefund ret_var = Refund_clone(arg);
51424         uint64_t ret_ref = 0;
51425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51427         return ret_ref;
51428 }
51429 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
51430         LDKRefund arg_conv;
51431         arg_conv.inner = untag_ptr(arg);
51432         arg_conv.is_owned = ptr_is_owned(arg);
51433         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51434         arg_conv.is_owned = false;
51435         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
51436         return ret_conv;
51437 }
51438
51439 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
51440         LDKRefund orig_conv;
51441         orig_conv.inner = untag_ptr(orig);
51442         orig_conv.is_owned = ptr_is_owned(orig);
51443         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51444         orig_conv.is_owned = false;
51445         LDKRefund ret_var = Refund_clone(&orig_conv);
51446         uint64_t ret_ref = 0;
51447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51449         return ret_ref;
51450 }
51451
51452 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
51453         LDKRefund this_arg_conv;
51454         this_arg_conv.inner = untag_ptr(this_arg);
51455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51457         this_arg_conv.is_owned = false;
51458         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
51459         uint64_t ret_ref = 0;
51460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51462         return ret_ref;
51463 }
51464
51465 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
51466         LDKRefund this_arg_conv;
51467         this_arg_conv.inner = untag_ptr(this_arg);
51468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51470         this_arg_conv.is_owned = false;
51471         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
51472         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
51473         uint64_t ret_ref = tag_ptr(ret_copy, true);
51474         return ret_ref;
51475 }
51476
51477 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
51478         LDKRefund this_arg_conv;
51479         this_arg_conv.inner = untag_ptr(this_arg);
51480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51482         this_arg_conv.is_owned = false;
51483         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
51484         uint64_t ret_ref = 0;
51485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51487         return ret_ref;
51488 }
51489
51490 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
51491         LDKRefund this_arg_conv;
51492         this_arg_conv.inner = untag_ptr(this_arg);
51493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51495         this_arg_conv.is_owned = false;
51496         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
51497         uint64_tArray ret_arr = NULL;
51498         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
51499         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
51500         for (size_t n = 0; n < ret_var.datalen; n++) {
51501                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
51502                 uint64_t ret_conv_13_ref = 0;
51503                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
51504                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
51505                 ret_arr_ptr[n] = ret_conv_13_ref;
51506         }
51507         
51508         FREE(ret_var.data);
51509         return ret_arr;
51510 }
51511
51512 int8_tArray  __attribute__((export_name("TS_Refund_metadata"))) TS_Refund_metadata(uint64_t this_arg) {
51513         LDKRefund this_arg_conv;
51514         this_arg_conv.inner = untag_ptr(this_arg);
51515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51517         this_arg_conv.is_owned = false;
51518         LDKu8slice ret_var = Refund_metadata(&this_arg_conv);
51519         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51520         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51521         return ret_arr;
51522 }
51523
51524 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
51525         LDKRefund this_arg_conv;
51526         this_arg_conv.inner = untag_ptr(this_arg);
51527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51529         this_arg_conv.is_owned = false;
51530         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51531         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
51532         return ret_arr;
51533 }
51534
51535 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
51536         LDKRefund this_arg_conv;
51537         this_arg_conv.inner = untag_ptr(this_arg);
51538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51540         this_arg_conv.is_owned = false;
51541         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
51542         return ret_conv;
51543 }
51544
51545 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
51546         LDKRefund this_arg_conv;
51547         this_arg_conv.inner = untag_ptr(this_arg);
51548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51550         this_arg_conv.is_owned = false;
51551         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
51552         uint64_t ret_ref = 0;
51553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51555         return ret_ref;
51556 }
51557
51558 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
51559         LDKRefund this_arg_conv;
51560         this_arg_conv.inner = untag_ptr(this_arg);
51561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51563         this_arg_conv.is_owned = false;
51564         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51565         *ret_copy = Refund_quantity(&this_arg_conv);
51566         uint64_t ret_ref = tag_ptr(ret_copy, true);
51567         return ret_ref;
51568 }
51569
51570 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
51571         LDKRefund this_arg_conv;
51572         this_arg_conv.inner = untag_ptr(this_arg);
51573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51575         this_arg_conv.is_owned = false;
51576         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51577         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
51578         return ret_arr;
51579 }
51580
51581 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
51582         LDKRefund this_arg_conv;
51583         this_arg_conv.inner = untag_ptr(this_arg);
51584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51586         this_arg_conv.is_owned = false;
51587         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
51588         uint64_t ret_ref = 0;
51589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51591         return ret_ref;
51592 }
51593
51594 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
51595         LDKRefund obj_conv;
51596         obj_conv.inner = untag_ptr(obj);
51597         obj_conv.is_owned = ptr_is_owned(obj);
51598         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51599         obj_conv.is_owned = false;
51600         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
51601         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51602         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51603         CVec_u8Z_free(ret_var);
51604         return ret_arr;
51605 }
51606
51607 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
51608         LDKStr s_conv = str_ref_to_owned_c(s);
51609         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
51610         *ret_conv = Refund_from_str(s_conv);
51611         return tag_ptr(ret_conv, true);
51612 }
51613
51614 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
51615         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
51616         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
51617         return ret_conv;
51618 }
51619
51620 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
51621         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
51622         return ret_conv;
51623 }
51624
51625 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
51626         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
51627         return ret_conv;
51628 }
51629
51630 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
51631         if (!ptr_is_owned(this_ptr)) return;
51632         void* this_ptr_ptr = untag_ptr(this_ptr);
51633         CHECK_ACCESS(this_ptr_ptr);
51634         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
51635         FREE(untag_ptr(this_ptr));
51636         UtxoResult_free(this_ptr_conv);
51637 }
51638
51639 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
51640         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
51641         *ret_copy = UtxoResult_clone(arg);
51642         uint64_t ret_ref = tag_ptr(ret_copy, true);
51643         return ret_ref;
51644 }
51645 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
51646         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
51647         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
51648         return ret_conv;
51649 }
51650
51651 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
51652         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
51653         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
51654         *ret_copy = UtxoResult_clone(orig_conv);
51655         uint64_t ret_ref = tag_ptr(ret_copy, true);
51656         return ret_ref;
51657 }
51658
51659 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
51660         void* a_ptr = untag_ptr(a);
51661         CHECK_ACCESS(a_ptr);
51662         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
51663         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
51664         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
51665         *ret_copy = UtxoResult_sync(a_conv);
51666         uint64_t ret_ref = tag_ptr(ret_copy, true);
51667         return ret_ref;
51668 }
51669
51670 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
51671         LDKUtxoFuture a_conv;
51672         a_conv.inner = untag_ptr(a);
51673         a_conv.is_owned = ptr_is_owned(a);
51674         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51675         a_conv = UtxoFuture_clone(&a_conv);
51676         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
51677         *ret_copy = UtxoResult_async(a_conv);
51678         uint64_t ret_ref = tag_ptr(ret_copy, true);
51679         return ret_ref;
51680 }
51681
51682 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
51683         if (!ptr_is_owned(this_ptr)) return;
51684         void* this_ptr_ptr = untag_ptr(this_ptr);
51685         CHECK_ACCESS(this_ptr_ptr);
51686         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
51687         FREE(untag_ptr(this_ptr));
51688         UtxoLookup_free(this_ptr_conv);
51689 }
51690
51691 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
51692         LDKUtxoFuture this_obj_conv;
51693         this_obj_conv.inner = untag_ptr(this_obj);
51694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51696         UtxoFuture_free(this_obj_conv);
51697 }
51698
51699 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
51700         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
51701         uint64_t ret_ref = 0;
51702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51704         return ret_ref;
51705 }
51706 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
51707         LDKUtxoFuture arg_conv;
51708         arg_conv.inner = untag_ptr(arg);
51709         arg_conv.is_owned = ptr_is_owned(arg);
51710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51711         arg_conv.is_owned = false;
51712         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
51713         return ret_conv;
51714 }
51715
51716 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
51717         LDKUtxoFuture orig_conv;
51718         orig_conv.inner = untag_ptr(orig);
51719         orig_conv.is_owned = ptr_is_owned(orig);
51720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51721         orig_conv.is_owned = false;
51722         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
51723         uint64_t ret_ref = 0;
51724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51726         return ret_ref;
51727 }
51728
51729 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
51730         LDKUtxoFuture ret_var = UtxoFuture_new();
51731         uint64_t ret_ref = 0;
51732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51734         return ret_ref;
51735 }
51736
51737 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
51738         LDKUtxoFuture this_arg_conv;
51739         this_arg_conv.inner = untag_ptr(this_arg);
51740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51742         this_arg_conv.is_owned = false;
51743         LDKNetworkGraph graph_conv;
51744         graph_conv.inner = untag_ptr(graph);
51745         graph_conv.is_owned = ptr_is_owned(graph);
51746         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
51747         graph_conv.is_owned = false;
51748         void* result_ptr = untag_ptr(result);
51749         CHECK_ACCESS(result_ptr);
51750         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
51751         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
51752 }
51753
51754 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
51755         LDKUtxoFuture this_arg_conv;
51756         this_arg_conv.inner = untag_ptr(this_arg);
51757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51759         this_arg_conv.is_owned = false;
51760         LDKNetworkGraph graph_conv;
51761         graph_conv.inner = untag_ptr(graph);
51762         graph_conv.is_owned = ptr_is_owned(graph);
51763         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
51764         graph_conv.is_owned = false;
51765         LDKP2PGossipSync gossip_conv;
51766         gossip_conv.inner = untag_ptr(gossip);
51767         gossip_conv.is_owned = ptr_is_owned(gossip);
51768         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
51769         gossip_conv.is_owned = false;
51770         void* result_ptr = untag_ptr(result);
51771         CHECK_ACCESS(result_ptr);
51772         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
51773         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
51774 }
51775
51776 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
51777         LDKNodeId this_obj_conv;
51778         this_obj_conv.inner = untag_ptr(this_obj);
51779         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51781         NodeId_free(this_obj_conv);
51782 }
51783
51784 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
51785         LDKNodeId ret_var = NodeId_clone(arg);
51786         uint64_t ret_ref = 0;
51787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51789         return ret_ref;
51790 }
51791 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
51792         LDKNodeId arg_conv;
51793         arg_conv.inner = untag_ptr(arg);
51794         arg_conv.is_owned = ptr_is_owned(arg);
51795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51796         arg_conv.is_owned = false;
51797         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
51798         return ret_conv;
51799 }
51800
51801 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
51802         LDKNodeId orig_conv;
51803         orig_conv.inner = untag_ptr(orig);
51804         orig_conv.is_owned = ptr_is_owned(orig);
51805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51806         orig_conv.is_owned = false;
51807         LDKNodeId ret_var = NodeId_clone(&orig_conv);
51808         uint64_t ret_ref = 0;
51809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51811         return ret_ref;
51812 }
51813
51814 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
51815         LDKPublicKey pubkey_ref;
51816         CHECK(pubkey->arr_len == 33);
51817         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
51818         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
51819         uint64_t ret_ref = 0;
51820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51822         return ret_ref;
51823 }
51824
51825 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
51826         LDKNodeId this_arg_conv;
51827         this_arg_conv.inner = untag_ptr(this_arg);
51828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51830         this_arg_conv.is_owned = false;
51831         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
51832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51834         return ret_arr;
51835 }
51836
51837 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
51838         LDKNodeId this_arg_conv;
51839         this_arg_conv.inner = untag_ptr(this_arg);
51840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51842         this_arg_conv.is_owned = false;
51843         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
51844         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
51845         return tag_ptr(ret_conv, true);
51846 }
51847
51848 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
51849         LDKNodeId o_conv;
51850         o_conv.inner = untag_ptr(o);
51851         o_conv.is_owned = ptr_is_owned(o);
51852         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51853         o_conv.is_owned = false;
51854         int64_t ret_conv = NodeId_hash(&o_conv);
51855         return ret_conv;
51856 }
51857
51858 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
51859         LDKNodeId obj_conv;
51860         obj_conv.inner = untag_ptr(obj);
51861         obj_conv.is_owned = ptr_is_owned(obj);
51862         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51863         obj_conv.is_owned = false;
51864         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
51865         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51866         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51867         CVec_u8Z_free(ret_var);
51868         return ret_arr;
51869 }
51870
51871 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
51872         LDKu8slice ser_ref;
51873         ser_ref.datalen = ser->arr_len;
51874         ser_ref.data = ser->elems;
51875         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
51876         *ret_conv = NodeId_read(ser_ref);
51877         FREE(ser);
51878         return tag_ptr(ret_conv, true);
51879 }
51880
51881 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
51882         LDKNetworkGraph this_obj_conv;
51883         this_obj_conv.inner = untag_ptr(this_obj);
51884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51886         NetworkGraph_free(this_obj_conv);
51887 }
51888
51889 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
51890         LDKReadOnlyNetworkGraph this_obj_conv;
51891         this_obj_conv.inner = untag_ptr(this_obj);
51892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51894         ReadOnlyNetworkGraph_free(this_obj_conv);
51895 }
51896
51897 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
51898         if (!ptr_is_owned(this_ptr)) return;
51899         void* this_ptr_ptr = untag_ptr(this_ptr);
51900         CHECK_ACCESS(this_ptr_ptr);
51901         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
51902         FREE(untag_ptr(this_ptr));
51903         NetworkUpdate_free(this_ptr_conv);
51904 }
51905
51906 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
51907         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51908         *ret_copy = NetworkUpdate_clone(arg);
51909         uint64_t ret_ref = tag_ptr(ret_copy, true);
51910         return ret_ref;
51911 }
51912 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
51913         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
51914         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
51915         return ret_conv;
51916 }
51917
51918 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
51919         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
51920         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51921         *ret_copy = NetworkUpdate_clone(orig_conv);
51922         uint64_t ret_ref = tag_ptr(ret_copy, true);
51923         return ret_ref;
51924 }
51925
51926 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
51927         LDKChannelUpdate msg_conv;
51928         msg_conv.inner = untag_ptr(msg);
51929         msg_conv.is_owned = ptr_is_owned(msg);
51930         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
51931         msg_conv = ChannelUpdate_clone(&msg_conv);
51932         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51933         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
51934         uint64_t ret_ref = tag_ptr(ret_copy, true);
51935         return ret_ref;
51936 }
51937
51938 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
51939         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51940         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
51941         uint64_t ret_ref = tag_ptr(ret_copy, true);
51942         return ret_ref;
51943 }
51944
51945 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
51946         LDKPublicKey node_id_ref;
51947         CHECK(node_id->arr_len == 33);
51948         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
51949         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51950         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
51951         uint64_t ret_ref = tag_ptr(ret_copy, true);
51952         return ret_ref;
51953 }
51954
51955 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
51956         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
51957         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
51958         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
51959         return ret_conv;
51960 }
51961
51962 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
51963         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
51964         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
51965         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51966         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51967         CVec_u8Z_free(ret_var);
51968         return ret_arr;
51969 }
51970
51971 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
51972         LDKu8slice ser_ref;
51973         ser_ref.datalen = ser->arr_len;
51974         ser_ref.data = ser->elems;
51975         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
51976         *ret_conv = NetworkUpdate_read(ser_ref);
51977         FREE(ser);
51978         return tag_ptr(ret_conv, true);
51979 }
51980
51981 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
51982         LDKP2PGossipSync this_obj_conv;
51983         this_obj_conv.inner = untag_ptr(this_obj);
51984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51986         P2PGossipSync_free(this_obj_conv);
51987 }
51988
51989 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
51990         LDKNetworkGraph network_graph_conv;
51991         network_graph_conv.inner = untag_ptr(network_graph);
51992         network_graph_conv.is_owned = ptr_is_owned(network_graph);
51993         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
51994         network_graph_conv.is_owned = false;
51995         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
51996         CHECK_ACCESS(utxo_lookup_ptr);
51997         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
51998         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
51999         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
52000                 // Manually implement clone for Java trait instances
52001                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
52002                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52003                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
52004                 }
52005         }
52006         void* logger_ptr = untag_ptr(logger);
52007         CHECK_ACCESS(logger_ptr);
52008         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52009         if (logger_conv.free == LDKLogger_JCalls_free) {
52010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52011                 LDKLogger_JCalls_cloned(&logger_conv);
52012         }
52013         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
52014         uint64_t ret_ref = 0;
52015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52017         return ret_ref;
52018 }
52019
52020 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
52021         LDKP2PGossipSync this_arg_conv;
52022         this_arg_conv.inner = untag_ptr(this_arg);
52023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52025         this_arg_conv.is_owned = false;
52026         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
52027         CHECK_ACCESS(utxo_lookup_ptr);
52028         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
52029         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
52030         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
52031                 // Manually implement clone for Java trait instances
52032                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
52033                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52034                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
52035                 }
52036         }
52037         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
52038 }
52039
52040 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
52041         LDKNetworkGraph this_arg_conv;
52042         this_arg_conv.inner = untag_ptr(this_arg);
52043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52045         this_arg_conv.is_owned = false;
52046         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
52047         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
52048 }
52049
52050 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_genesis_hash"))) TS_NetworkGraph_get_genesis_hash(uint64_t this_arg) {
52051         LDKNetworkGraph this_arg_conv;
52052         this_arg_conv.inner = untag_ptr(this_arg);
52053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52055         this_arg_conv.is_owned = false;
52056         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52057         memcpy(ret_arr->elems, NetworkGraph_get_genesis_hash(&this_arg_conv).data, 32);
52058         return ret_arr;
52059 }
52060
52061 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
52062         LDKNodeAnnouncement msg_conv;
52063         msg_conv.inner = untag_ptr(msg);
52064         msg_conv.is_owned = ptr_is_owned(msg);
52065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
52066         msg_conv.is_owned = false;
52067         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
52068         *ret_conv = verify_node_announcement(&msg_conv);
52069         return tag_ptr(ret_conv, true);
52070 }
52071
52072 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
52073         LDKChannelAnnouncement msg_conv;
52074         msg_conv.inner = untag_ptr(msg);
52075         msg_conv.is_owned = ptr_is_owned(msg);
52076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
52077         msg_conv.is_owned = false;
52078         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
52079         *ret_conv = verify_channel_announcement(&msg_conv);
52080         return tag_ptr(ret_conv, true);
52081 }
52082
52083 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
52084         LDKP2PGossipSync this_arg_conv;
52085         this_arg_conv.inner = untag_ptr(this_arg);
52086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52088         this_arg_conv.is_owned = false;
52089         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
52090         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
52091         return tag_ptr(ret_ret, true);
52092 }
52093
52094 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
52095         LDKP2PGossipSync this_arg_conv;
52096         this_arg_conv.inner = untag_ptr(this_arg);
52097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52099         this_arg_conv.is_owned = false;
52100         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52101         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
52102         return tag_ptr(ret_ret, true);
52103 }
52104
52105 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
52106         LDKChannelUpdateInfo this_obj_conv;
52107         this_obj_conv.inner = untag_ptr(this_obj);
52108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52110         ChannelUpdateInfo_free(this_obj_conv);
52111 }
52112
52113 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
52114         LDKChannelUpdateInfo this_ptr_conv;
52115         this_ptr_conv.inner = untag_ptr(this_ptr);
52116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52118         this_ptr_conv.is_owned = false;
52119         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
52120         return ret_conv;
52121 }
52122
52123 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
52124         LDKChannelUpdateInfo this_ptr_conv;
52125         this_ptr_conv.inner = untag_ptr(this_ptr);
52126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52128         this_ptr_conv.is_owned = false;
52129         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
52130 }
52131
52132 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
52133         LDKChannelUpdateInfo this_ptr_conv;
52134         this_ptr_conv.inner = untag_ptr(this_ptr);
52135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52137         this_ptr_conv.is_owned = false;
52138         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
52139         return ret_conv;
52140 }
52141
52142 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
52143         LDKChannelUpdateInfo this_ptr_conv;
52144         this_ptr_conv.inner = untag_ptr(this_ptr);
52145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52147         this_ptr_conv.is_owned = false;
52148         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
52149 }
52150
52151 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
52152         LDKChannelUpdateInfo this_ptr_conv;
52153         this_ptr_conv.inner = untag_ptr(this_ptr);
52154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52156         this_ptr_conv.is_owned = false;
52157         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
52158         return ret_conv;
52159 }
52160
52161 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
52162         LDKChannelUpdateInfo this_ptr_conv;
52163         this_ptr_conv.inner = untag_ptr(this_ptr);
52164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52166         this_ptr_conv.is_owned = false;
52167         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
52168 }
52169
52170 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
52171         LDKChannelUpdateInfo this_ptr_conv;
52172         this_ptr_conv.inner = untag_ptr(this_ptr);
52173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52175         this_ptr_conv.is_owned = false;
52176         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
52177         return ret_conv;
52178 }
52179
52180 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
52181         LDKChannelUpdateInfo this_ptr_conv;
52182         this_ptr_conv.inner = untag_ptr(this_ptr);
52183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52185         this_ptr_conv.is_owned = false;
52186         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
52187 }
52188
52189 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
52190         LDKChannelUpdateInfo this_ptr_conv;
52191         this_ptr_conv.inner = untag_ptr(this_ptr);
52192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52194         this_ptr_conv.is_owned = false;
52195         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
52196         return ret_conv;
52197 }
52198
52199 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
52200         LDKChannelUpdateInfo this_ptr_conv;
52201         this_ptr_conv.inner = untag_ptr(this_ptr);
52202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52204         this_ptr_conv.is_owned = false;
52205         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
52206 }
52207
52208 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
52209         LDKChannelUpdateInfo this_ptr_conv;
52210         this_ptr_conv.inner = untag_ptr(this_ptr);
52211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52213         this_ptr_conv.is_owned = false;
52214         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
52215         uint64_t ret_ref = 0;
52216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52218         return ret_ref;
52219 }
52220
52221 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
52222         LDKChannelUpdateInfo this_ptr_conv;
52223         this_ptr_conv.inner = untag_ptr(this_ptr);
52224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52226         this_ptr_conv.is_owned = false;
52227         LDKRoutingFees val_conv;
52228         val_conv.inner = untag_ptr(val);
52229         val_conv.is_owned = ptr_is_owned(val);
52230         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52231         val_conv = RoutingFees_clone(&val_conv);
52232         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
52233 }
52234
52235 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
52236         LDKChannelUpdateInfo this_ptr_conv;
52237         this_ptr_conv.inner = untag_ptr(this_ptr);
52238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52240         this_ptr_conv.is_owned = false;
52241         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
52242         uint64_t ret_ref = 0;
52243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52245         return ret_ref;
52246 }
52247
52248 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
52249         LDKChannelUpdateInfo this_ptr_conv;
52250         this_ptr_conv.inner = untag_ptr(this_ptr);
52251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52253         this_ptr_conv.is_owned = false;
52254         LDKChannelUpdate val_conv;
52255         val_conv.inner = untag_ptr(val);
52256         val_conv.is_owned = ptr_is_owned(val);
52257         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52258         val_conv = ChannelUpdate_clone(&val_conv);
52259         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
52260 }
52261
52262 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) {
52263         LDKRoutingFees fees_arg_conv;
52264         fees_arg_conv.inner = untag_ptr(fees_arg);
52265         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
52266         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
52267         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
52268         LDKChannelUpdate last_update_message_arg_conv;
52269         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
52270         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
52271         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
52272         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
52273         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);
52274         uint64_t ret_ref = 0;
52275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52277         return ret_ref;
52278 }
52279
52280 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
52281         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
52282         uint64_t ret_ref = 0;
52283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52285         return ret_ref;
52286 }
52287 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
52288         LDKChannelUpdateInfo arg_conv;
52289         arg_conv.inner = untag_ptr(arg);
52290         arg_conv.is_owned = ptr_is_owned(arg);
52291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52292         arg_conv.is_owned = false;
52293         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
52294         return ret_conv;
52295 }
52296
52297 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
52298         LDKChannelUpdateInfo orig_conv;
52299         orig_conv.inner = untag_ptr(orig);
52300         orig_conv.is_owned = ptr_is_owned(orig);
52301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52302         orig_conv.is_owned = false;
52303         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
52304         uint64_t ret_ref = 0;
52305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52307         return ret_ref;
52308 }
52309
52310 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
52311         LDKChannelUpdateInfo a_conv;
52312         a_conv.inner = untag_ptr(a);
52313         a_conv.is_owned = ptr_is_owned(a);
52314         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52315         a_conv.is_owned = false;
52316         LDKChannelUpdateInfo b_conv;
52317         b_conv.inner = untag_ptr(b);
52318         b_conv.is_owned = ptr_is_owned(b);
52319         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52320         b_conv.is_owned = false;
52321         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
52322         return ret_conv;
52323 }
52324
52325 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
52326         LDKChannelUpdateInfo obj_conv;
52327         obj_conv.inner = untag_ptr(obj);
52328         obj_conv.is_owned = ptr_is_owned(obj);
52329         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52330         obj_conv.is_owned = false;
52331         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
52332         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52333         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52334         CVec_u8Z_free(ret_var);
52335         return ret_arr;
52336 }
52337
52338 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
52339         LDKu8slice ser_ref;
52340         ser_ref.datalen = ser->arr_len;
52341         ser_ref.data = ser->elems;
52342         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
52343         *ret_conv = ChannelUpdateInfo_read(ser_ref);
52344         FREE(ser);
52345         return tag_ptr(ret_conv, true);
52346 }
52347
52348 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
52349         LDKChannelInfo this_obj_conv;
52350         this_obj_conv.inner = untag_ptr(this_obj);
52351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52353         ChannelInfo_free(this_obj_conv);
52354 }
52355
52356 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
52357         LDKChannelInfo this_ptr_conv;
52358         this_ptr_conv.inner = untag_ptr(this_ptr);
52359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52361         this_ptr_conv.is_owned = false;
52362         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
52363         uint64_t ret_ref = 0;
52364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52366         return ret_ref;
52367 }
52368
52369 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
52370         LDKChannelInfo this_ptr_conv;
52371         this_ptr_conv.inner = untag_ptr(this_ptr);
52372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52374         this_ptr_conv.is_owned = false;
52375         LDKChannelFeatures val_conv;
52376         val_conv.inner = untag_ptr(val);
52377         val_conv.is_owned = ptr_is_owned(val);
52378         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52379         val_conv = ChannelFeatures_clone(&val_conv);
52380         ChannelInfo_set_features(&this_ptr_conv, val_conv);
52381 }
52382
52383 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
52384         LDKChannelInfo this_ptr_conv;
52385         this_ptr_conv.inner = untag_ptr(this_ptr);
52386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52388         this_ptr_conv.is_owned = false;
52389         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
52390         uint64_t ret_ref = 0;
52391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52393         return ret_ref;
52394 }
52395
52396 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
52397         LDKChannelInfo this_ptr_conv;
52398         this_ptr_conv.inner = untag_ptr(this_ptr);
52399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52401         this_ptr_conv.is_owned = false;
52402         LDKNodeId val_conv;
52403         val_conv.inner = untag_ptr(val);
52404         val_conv.is_owned = ptr_is_owned(val);
52405         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52406         val_conv = NodeId_clone(&val_conv);
52407         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
52408 }
52409
52410 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
52411         LDKChannelInfo this_ptr_conv;
52412         this_ptr_conv.inner = untag_ptr(this_ptr);
52413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52415         this_ptr_conv.is_owned = false;
52416         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
52417         uint64_t ret_ref = 0;
52418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52420         return ret_ref;
52421 }
52422
52423 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
52424         LDKChannelInfo this_ptr_conv;
52425         this_ptr_conv.inner = untag_ptr(this_ptr);
52426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52428         this_ptr_conv.is_owned = false;
52429         LDKChannelUpdateInfo val_conv;
52430         val_conv.inner = untag_ptr(val);
52431         val_conv.is_owned = ptr_is_owned(val);
52432         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52433         val_conv = ChannelUpdateInfo_clone(&val_conv);
52434         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
52435 }
52436
52437 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
52438         LDKChannelInfo this_ptr_conv;
52439         this_ptr_conv.inner = untag_ptr(this_ptr);
52440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52442         this_ptr_conv.is_owned = false;
52443         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
52444         uint64_t ret_ref = 0;
52445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52447         return ret_ref;
52448 }
52449
52450 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
52451         LDKChannelInfo this_ptr_conv;
52452         this_ptr_conv.inner = untag_ptr(this_ptr);
52453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52455         this_ptr_conv.is_owned = false;
52456         LDKNodeId val_conv;
52457         val_conv.inner = untag_ptr(val);
52458         val_conv.is_owned = ptr_is_owned(val);
52459         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52460         val_conv = NodeId_clone(&val_conv);
52461         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
52462 }
52463
52464 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
52465         LDKChannelInfo this_ptr_conv;
52466         this_ptr_conv.inner = untag_ptr(this_ptr);
52467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52469         this_ptr_conv.is_owned = false;
52470         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
52471         uint64_t ret_ref = 0;
52472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52474         return ret_ref;
52475 }
52476
52477 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
52478         LDKChannelInfo this_ptr_conv;
52479         this_ptr_conv.inner = untag_ptr(this_ptr);
52480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52482         this_ptr_conv.is_owned = false;
52483         LDKChannelUpdateInfo val_conv;
52484         val_conv.inner = untag_ptr(val);
52485         val_conv.is_owned = ptr_is_owned(val);
52486         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52487         val_conv = ChannelUpdateInfo_clone(&val_conv);
52488         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
52489 }
52490
52491 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
52492         LDKChannelInfo this_ptr_conv;
52493         this_ptr_conv.inner = untag_ptr(this_ptr);
52494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52496         this_ptr_conv.is_owned = false;
52497         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52498         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
52499         uint64_t ret_ref = tag_ptr(ret_copy, true);
52500         return ret_ref;
52501 }
52502
52503 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
52504         LDKChannelInfo this_ptr_conv;
52505         this_ptr_conv.inner = untag_ptr(this_ptr);
52506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52508         this_ptr_conv.is_owned = false;
52509         void* val_ptr = untag_ptr(val);
52510         CHECK_ACCESS(val_ptr);
52511         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
52512         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
52513         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
52514 }
52515
52516 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
52517         LDKChannelInfo this_ptr_conv;
52518         this_ptr_conv.inner = untag_ptr(this_ptr);
52519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52521         this_ptr_conv.is_owned = false;
52522         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
52523         uint64_t ret_ref = 0;
52524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52526         return ret_ref;
52527 }
52528
52529 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
52530         LDKChannelInfo this_ptr_conv;
52531         this_ptr_conv.inner = untag_ptr(this_ptr);
52532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52534         this_ptr_conv.is_owned = false;
52535         LDKChannelAnnouncement val_conv;
52536         val_conv.inner = untag_ptr(val);
52537         val_conv.is_owned = ptr_is_owned(val);
52538         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52539         val_conv = ChannelAnnouncement_clone(&val_conv);
52540         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
52541 }
52542
52543 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
52544         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
52545         uint64_t ret_ref = 0;
52546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52548         return ret_ref;
52549 }
52550 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
52551         LDKChannelInfo arg_conv;
52552         arg_conv.inner = untag_ptr(arg);
52553         arg_conv.is_owned = ptr_is_owned(arg);
52554         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52555         arg_conv.is_owned = false;
52556         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
52557         return ret_conv;
52558 }
52559
52560 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
52561         LDKChannelInfo orig_conv;
52562         orig_conv.inner = untag_ptr(orig);
52563         orig_conv.is_owned = ptr_is_owned(orig);
52564         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52565         orig_conv.is_owned = false;
52566         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
52567         uint64_t ret_ref = 0;
52568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52570         return ret_ref;
52571 }
52572
52573 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
52574         LDKChannelInfo a_conv;
52575         a_conv.inner = untag_ptr(a);
52576         a_conv.is_owned = ptr_is_owned(a);
52577         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52578         a_conv.is_owned = false;
52579         LDKChannelInfo b_conv;
52580         b_conv.inner = untag_ptr(b);
52581         b_conv.is_owned = ptr_is_owned(b);
52582         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52583         b_conv.is_owned = false;
52584         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
52585         return ret_conv;
52586 }
52587
52588 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
52589         LDKChannelInfo this_arg_conv;
52590         this_arg_conv.inner = untag_ptr(this_arg);
52591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52593         this_arg_conv.is_owned = false;
52594         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
52595         uint64_t ret_ref = 0;
52596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52598         return ret_ref;
52599 }
52600
52601 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
52602         LDKChannelInfo obj_conv;
52603         obj_conv.inner = untag_ptr(obj);
52604         obj_conv.is_owned = ptr_is_owned(obj);
52605         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52606         obj_conv.is_owned = false;
52607         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
52608         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52609         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52610         CVec_u8Z_free(ret_var);
52611         return ret_arr;
52612 }
52613
52614 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
52615         LDKu8slice ser_ref;
52616         ser_ref.datalen = ser->arr_len;
52617         ser_ref.data = ser->elems;
52618         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
52619         *ret_conv = ChannelInfo_read(ser_ref);
52620         FREE(ser);
52621         return tag_ptr(ret_conv, true);
52622 }
52623
52624 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
52625         LDKDirectedChannelInfo this_obj_conv;
52626         this_obj_conv.inner = untag_ptr(this_obj);
52627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52629         DirectedChannelInfo_free(this_obj_conv);
52630 }
52631
52632 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
52633         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
52634         uint64_t ret_ref = 0;
52635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52637         return ret_ref;
52638 }
52639 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
52640         LDKDirectedChannelInfo arg_conv;
52641         arg_conv.inner = untag_ptr(arg);
52642         arg_conv.is_owned = ptr_is_owned(arg);
52643         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52644         arg_conv.is_owned = false;
52645         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
52646         return ret_conv;
52647 }
52648
52649 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
52650         LDKDirectedChannelInfo orig_conv;
52651         orig_conv.inner = untag_ptr(orig);
52652         orig_conv.is_owned = ptr_is_owned(orig);
52653         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52654         orig_conv.is_owned = false;
52655         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
52656         uint64_t ret_ref = 0;
52657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52659         return ret_ref;
52660 }
52661
52662 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
52663         LDKDirectedChannelInfo this_arg_conv;
52664         this_arg_conv.inner = untag_ptr(this_arg);
52665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52667         this_arg_conv.is_owned = false;
52668         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
52669         uint64_t ret_ref = 0;
52670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52672         return ret_ref;
52673 }
52674
52675 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
52676         LDKDirectedChannelInfo this_arg_conv;
52677         this_arg_conv.inner = untag_ptr(this_arg);
52678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52680         this_arg_conv.is_owned = false;
52681         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
52682         return ret_conv;
52683 }
52684
52685 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
52686         LDKDirectedChannelInfo this_arg_conv;
52687         this_arg_conv.inner = untag_ptr(this_arg);
52688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52690         this_arg_conv.is_owned = false;
52691         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52692         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
52693         uint64_t ret_ref = tag_ptr(ret_copy, true);
52694         return ret_ref;
52695 }
52696
52697 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
52698         if (!ptr_is_owned(this_ptr)) return;
52699         void* this_ptr_ptr = untag_ptr(this_ptr);
52700         CHECK_ACCESS(this_ptr_ptr);
52701         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
52702         FREE(untag_ptr(this_ptr));
52703         EffectiveCapacity_free(this_ptr_conv);
52704 }
52705
52706 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
52707         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52708         *ret_copy = EffectiveCapacity_clone(arg);
52709         uint64_t ret_ref = tag_ptr(ret_copy, true);
52710         return ret_ref;
52711 }
52712 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
52713         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
52714         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
52715         return ret_conv;
52716 }
52717
52718 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
52719         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
52720         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52721         *ret_copy = EffectiveCapacity_clone(orig_conv);
52722         uint64_t ret_ref = tag_ptr(ret_copy, true);
52723         return ret_ref;
52724 }
52725
52726 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
52727         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52728         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
52729         uint64_t ret_ref = tag_ptr(ret_copy, true);
52730         return ret_ref;
52731 }
52732
52733 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
52734         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52735         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
52736         uint64_t ret_ref = tag_ptr(ret_copy, true);
52737         return ret_ref;
52738 }
52739
52740 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
52741         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52742         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
52743         uint64_t ret_ref = tag_ptr(ret_copy, true);
52744         return ret_ref;
52745 }
52746
52747 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
52748         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52749         *ret_copy = EffectiveCapacity_infinite();
52750         uint64_t ret_ref = tag_ptr(ret_copy, true);
52751         return ret_ref;
52752 }
52753
52754 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
52755         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52756         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
52757         uint64_t ret_ref = tag_ptr(ret_copy, true);
52758         return ret_ref;
52759 }
52760
52761 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
52762         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52763         *ret_copy = EffectiveCapacity_unknown();
52764         uint64_t ret_ref = tag_ptr(ret_copy, true);
52765         return ret_ref;
52766 }
52767
52768 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
52769         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
52770         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
52771         return ret_conv;
52772 }
52773
52774 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
52775         LDKRoutingFees this_obj_conv;
52776         this_obj_conv.inner = untag_ptr(this_obj);
52777         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52779         RoutingFees_free(this_obj_conv);
52780 }
52781
52782 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
52783         LDKRoutingFees this_ptr_conv;
52784         this_ptr_conv.inner = untag_ptr(this_ptr);
52785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52787         this_ptr_conv.is_owned = false;
52788         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
52789         return ret_conv;
52790 }
52791
52792 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
52793         LDKRoutingFees this_ptr_conv;
52794         this_ptr_conv.inner = untag_ptr(this_ptr);
52795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52797         this_ptr_conv.is_owned = false;
52798         RoutingFees_set_base_msat(&this_ptr_conv, val);
52799 }
52800
52801 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
52802         LDKRoutingFees this_ptr_conv;
52803         this_ptr_conv.inner = untag_ptr(this_ptr);
52804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52806         this_ptr_conv.is_owned = false;
52807         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
52808         return ret_conv;
52809 }
52810
52811 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
52812         LDKRoutingFees this_ptr_conv;
52813         this_ptr_conv.inner = untag_ptr(this_ptr);
52814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52816         this_ptr_conv.is_owned = false;
52817         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
52818 }
52819
52820 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
52821         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
52822         uint64_t ret_ref = 0;
52823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52825         return ret_ref;
52826 }
52827
52828 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
52829         LDKRoutingFees a_conv;
52830         a_conv.inner = untag_ptr(a);
52831         a_conv.is_owned = ptr_is_owned(a);
52832         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52833         a_conv.is_owned = false;
52834         LDKRoutingFees b_conv;
52835         b_conv.inner = untag_ptr(b);
52836         b_conv.is_owned = ptr_is_owned(b);
52837         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52838         b_conv.is_owned = false;
52839         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
52840         return ret_conv;
52841 }
52842
52843 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
52844         LDKRoutingFees ret_var = RoutingFees_clone(arg);
52845         uint64_t ret_ref = 0;
52846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52848         return ret_ref;
52849 }
52850 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
52851         LDKRoutingFees arg_conv;
52852         arg_conv.inner = untag_ptr(arg);
52853         arg_conv.is_owned = ptr_is_owned(arg);
52854         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52855         arg_conv.is_owned = false;
52856         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
52857         return ret_conv;
52858 }
52859
52860 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
52861         LDKRoutingFees orig_conv;
52862         orig_conv.inner = untag_ptr(orig);
52863         orig_conv.is_owned = ptr_is_owned(orig);
52864         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52865         orig_conv.is_owned = false;
52866         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
52867         uint64_t ret_ref = 0;
52868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52870         return ret_ref;
52871 }
52872
52873 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
52874         LDKRoutingFees o_conv;
52875         o_conv.inner = untag_ptr(o);
52876         o_conv.is_owned = ptr_is_owned(o);
52877         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52878         o_conv.is_owned = false;
52879         int64_t ret_conv = RoutingFees_hash(&o_conv);
52880         return ret_conv;
52881 }
52882
52883 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
52884         LDKRoutingFees obj_conv;
52885         obj_conv.inner = untag_ptr(obj);
52886         obj_conv.is_owned = ptr_is_owned(obj);
52887         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52888         obj_conv.is_owned = false;
52889         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
52890         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52891         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52892         CVec_u8Z_free(ret_var);
52893         return ret_arr;
52894 }
52895
52896 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
52897         LDKu8slice ser_ref;
52898         ser_ref.datalen = ser->arr_len;
52899         ser_ref.data = ser->elems;
52900         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
52901         *ret_conv = RoutingFees_read(ser_ref);
52902         FREE(ser);
52903         return tag_ptr(ret_conv, true);
52904 }
52905
52906 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
52907         LDKNodeAnnouncementInfo this_obj_conv;
52908         this_obj_conv.inner = untag_ptr(this_obj);
52909         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52911         NodeAnnouncementInfo_free(this_obj_conv);
52912 }
52913
52914 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
52915         LDKNodeAnnouncementInfo this_ptr_conv;
52916         this_ptr_conv.inner = untag_ptr(this_ptr);
52917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52919         this_ptr_conv.is_owned = false;
52920         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
52921         uint64_t ret_ref = 0;
52922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52924         return ret_ref;
52925 }
52926
52927 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
52928         LDKNodeAnnouncementInfo this_ptr_conv;
52929         this_ptr_conv.inner = untag_ptr(this_ptr);
52930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52932         this_ptr_conv.is_owned = false;
52933         LDKNodeFeatures val_conv;
52934         val_conv.inner = untag_ptr(val);
52935         val_conv.is_owned = ptr_is_owned(val);
52936         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52937         val_conv = NodeFeatures_clone(&val_conv);
52938         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
52939 }
52940
52941 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
52942         LDKNodeAnnouncementInfo this_ptr_conv;
52943         this_ptr_conv.inner = untag_ptr(this_ptr);
52944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52946         this_ptr_conv.is_owned = false;
52947         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
52948         return ret_conv;
52949 }
52950
52951 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
52952         LDKNodeAnnouncementInfo 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         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
52958 }
52959
52960 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
52961         LDKNodeAnnouncementInfo this_ptr_conv;
52962         this_ptr_conv.inner = untag_ptr(this_ptr);
52963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52965         this_ptr_conv.is_owned = false;
52966         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
52967         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
52968         return ret_arr;
52969 }
52970
52971 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
52972         LDKNodeAnnouncementInfo this_ptr_conv;
52973         this_ptr_conv.inner = untag_ptr(this_ptr);
52974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52976         this_ptr_conv.is_owned = false;
52977         LDKThreeBytes val_ref;
52978         CHECK(val->arr_len == 3);
52979         memcpy(val_ref.data, val->elems, 3); FREE(val);
52980         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
52981 }
52982
52983 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
52984         LDKNodeAnnouncementInfo this_ptr_conv;
52985         this_ptr_conv.inner = untag_ptr(this_ptr);
52986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52988         this_ptr_conv.is_owned = false;
52989         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
52990         uint64_t ret_ref = 0;
52991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52993         return ret_ref;
52994 }
52995
52996 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
52997         LDKNodeAnnouncementInfo this_ptr_conv;
52998         this_ptr_conv.inner = untag_ptr(this_ptr);
52999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53001         this_ptr_conv.is_owned = false;
53002         LDKNodeAlias val_conv;
53003         val_conv.inner = untag_ptr(val);
53004         val_conv.is_owned = ptr_is_owned(val);
53005         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53006         val_conv = NodeAlias_clone(&val_conv);
53007         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
53008 }
53009
53010 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
53011         LDKNodeAnnouncementInfo this_ptr_conv;
53012         this_ptr_conv.inner = untag_ptr(this_ptr);
53013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53015         this_ptr_conv.is_owned = false;
53016         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
53017         uint64_t ret_ref = 0;
53018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53020         return ret_ref;
53021 }
53022
53023 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
53024         LDKNodeAnnouncementInfo this_ptr_conv;
53025         this_ptr_conv.inner = untag_ptr(this_ptr);
53026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53028         this_ptr_conv.is_owned = false;
53029         LDKNodeAnnouncement val_conv;
53030         val_conv.inner = untag_ptr(val);
53031         val_conv.is_owned = ptr_is_owned(val);
53032         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53033         val_conv = NodeAnnouncement_clone(&val_conv);
53034         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
53035 }
53036
53037 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) {
53038         LDKNodeFeatures features_arg_conv;
53039         features_arg_conv.inner = untag_ptr(features_arg);
53040         features_arg_conv.is_owned = ptr_is_owned(features_arg);
53041         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
53042         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
53043         LDKThreeBytes rgb_arg_ref;
53044         CHECK(rgb_arg->arr_len == 3);
53045         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
53046         LDKNodeAlias alias_arg_conv;
53047         alias_arg_conv.inner = untag_ptr(alias_arg);
53048         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
53049         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
53050         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
53051         LDKNodeAnnouncement announcement_message_arg_conv;
53052         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
53053         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
53054         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
53055         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
53056         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
53057         uint64_t ret_ref = 0;
53058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53060         return ret_ref;
53061 }
53062
53063 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
53064         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
53065         uint64_t ret_ref = 0;
53066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53068         return ret_ref;
53069 }
53070 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
53071         LDKNodeAnnouncementInfo arg_conv;
53072         arg_conv.inner = untag_ptr(arg);
53073         arg_conv.is_owned = ptr_is_owned(arg);
53074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53075         arg_conv.is_owned = false;
53076         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
53077         return ret_conv;
53078 }
53079
53080 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
53081         LDKNodeAnnouncementInfo orig_conv;
53082         orig_conv.inner = untag_ptr(orig);
53083         orig_conv.is_owned = ptr_is_owned(orig);
53084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53085         orig_conv.is_owned = false;
53086         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
53087         uint64_t ret_ref = 0;
53088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53090         return ret_ref;
53091 }
53092
53093 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
53094         LDKNodeAnnouncementInfo a_conv;
53095         a_conv.inner = untag_ptr(a);
53096         a_conv.is_owned = ptr_is_owned(a);
53097         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53098         a_conv.is_owned = false;
53099         LDKNodeAnnouncementInfo b_conv;
53100         b_conv.inner = untag_ptr(b);
53101         b_conv.is_owned = ptr_is_owned(b);
53102         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53103         b_conv.is_owned = false;
53104         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
53105         return ret_conv;
53106 }
53107
53108 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
53109         LDKNodeAnnouncementInfo this_arg_conv;
53110         this_arg_conv.inner = untag_ptr(this_arg);
53111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53113         this_arg_conv.is_owned = false;
53114         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
53115         uint64_tArray ret_arr = NULL;
53116         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53117         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53118         for (size_t m = 0; m < ret_var.datalen; m++) {
53119                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
53120                 *ret_conv_12_copy = ret_var.data[m];
53121                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
53122                 ret_arr_ptr[m] = ret_conv_12_ref;
53123         }
53124         
53125         FREE(ret_var.data);
53126         return ret_arr;
53127 }
53128
53129 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
53130         LDKNodeAnnouncementInfo obj_conv;
53131         obj_conv.inner = untag_ptr(obj);
53132         obj_conv.is_owned = ptr_is_owned(obj);
53133         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53134         obj_conv.is_owned = false;
53135         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
53136         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53137         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53138         CVec_u8Z_free(ret_var);
53139         return ret_arr;
53140 }
53141
53142 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
53143         LDKu8slice ser_ref;
53144         ser_ref.datalen = ser->arr_len;
53145         ser_ref.data = ser->elems;
53146         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
53147         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
53148         FREE(ser);
53149         return tag_ptr(ret_conv, true);
53150 }
53151
53152 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
53153         LDKNodeAlias this_obj_conv;
53154         this_obj_conv.inner = untag_ptr(this_obj);
53155         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53157         NodeAlias_free(this_obj_conv);
53158 }
53159
53160 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
53161         LDKNodeAlias this_ptr_conv;
53162         this_ptr_conv.inner = untag_ptr(this_ptr);
53163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53165         this_ptr_conv.is_owned = false;
53166         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53167         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
53168         return ret_arr;
53169 }
53170
53171 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
53172         LDKNodeAlias this_ptr_conv;
53173         this_ptr_conv.inner = untag_ptr(this_ptr);
53174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53176         this_ptr_conv.is_owned = false;
53177         LDKThirtyTwoBytes val_ref;
53178         CHECK(val->arr_len == 32);
53179         memcpy(val_ref.data, val->elems, 32); FREE(val);
53180         NodeAlias_set_a(&this_ptr_conv, val_ref);
53181 }
53182
53183 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
53184         LDKThirtyTwoBytes a_arg_ref;
53185         CHECK(a_arg->arr_len == 32);
53186         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
53187         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
53188         uint64_t ret_ref = 0;
53189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53191         return ret_ref;
53192 }
53193
53194 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
53195         LDKNodeAlias ret_var = NodeAlias_clone(arg);
53196         uint64_t ret_ref = 0;
53197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53199         return ret_ref;
53200 }
53201 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
53202         LDKNodeAlias arg_conv;
53203         arg_conv.inner = untag_ptr(arg);
53204         arg_conv.is_owned = ptr_is_owned(arg);
53205         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53206         arg_conv.is_owned = false;
53207         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
53208         return ret_conv;
53209 }
53210
53211 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
53212         LDKNodeAlias orig_conv;
53213         orig_conv.inner = untag_ptr(orig);
53214         orig_conv.is_owned = ptr_is_owned(orig);
53215         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53216         orig_conv.is_owned = false;
53217         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
53218         uint64_t ret_ref = 0;
53219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53221         return ret_ref;
53222 }
53223
53224 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
53225         LDKNodeAlias a_conv;
53226         a_conv.inner = untag_ptr(a);
53227         a_conv.is_owned = ptr_is_owned(a);
53228         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53229         a_conv.is_owned = false;
53230         LDKNodeAlias b_conv;
53231         b_conv.inner = untag_ptr(b);
53232         b_conv.is_owned = ptr_is_owned(b);
53233         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53234         b_conv.is_owned = false;
53235         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
53236         return ret_conv;
53237 }
53238
53239 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
53240         LDKNodeAlias obj_conv;
53241         obj_conv.inner = untag_ptr(obj);
53242         obj_conv.is_owned = ptr_is_owned(obj);
53243         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53244         obj_conv.is_owned = false;
53245         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
53246         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53247         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53248         CVec_u8Z_free(ret_var);
53249         return ret_arr;
53250 }
53251
53252 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
53253         LDKu8slice ser_ref;
53254         ser_ref.datalen = ser->arr_len;
53255         ser_ref.data = ser->elems;
53256         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
53257         *ret_conv = NodeAlias_read(ser_ref);
53258         FREE(ser);
53259         return tag_ptr(ret_conv, true);
53260 }
53261
53262 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
53263         LDKNodeInfo this_obj_conv;
53264         this_obj_conv.inner = untag_ptr(this_obj);
53265         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53267         NodeInfo_free(this_obj_conv);
53268 }
53269
53270 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
53271         LDKNodeInfo this_ptr_conv;
53272         this_ptr_conv.inner = untag_ptr(this_ptr);
53273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53275         this_ptr_conv.is_owned = false;
53276         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
53277         int64_tArray ret_arr = NULL;
53278         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53279         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53280         for (size_t i = 0; i < ret_var.datalen; i++) {
53281                 int64_t ret_conv_8_conv = ret_var.data[i];
53282                 ret_arr_ptr[i] = ret_conv_8_conv;
53283         }
53284         
53285         FREE(ret_var.data);
53286         return ret_arr;
53287 }
53288
53289 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
53290         LDKNodeInfo this_ptr_conv;
53291         this_ptr_conv.inner = untag_ptr(this_ptr);
53292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53294         this_ptr_conv.is_owned = false;
53295         LDKCVec_u64Z val_constr;
53296         val_constr.datalen = val->arr_len;
53297         if (val_constr.datalen > 0)
53298                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53299         else
53300                 val_constr.data = NULL;
53301         int64_t* val_vals = val->elems;
53302         for (size_t i = 0; i < val_constr.datalen; i++) {
53303                 int64_t val_conv_8 = val_vals[i];
53304                 val_constr.data[i] = val_conv_8;
53305         }
53306         FREE(val);
53307         NodeInfo_set_channels(&this_ptr_conv, val_constr);
53308 }
53309
53310 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
53311         LDKNodeInfo this_ptr_conv;
53312         this_ptr_conv.inner = untag_ptr(this_ptr);
53313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53315         this_ptr_conv.is_owned = false;
53316         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
53317         uint64_t ret_ref = 0;
53318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53320         return ret_ref;
53321 }
53322
53323 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
53324         LDKNodeInfo this_ptr_conv;
53325         this_ptr_conv.inner = untag_ptr(this_ptr);
53326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53328         this_ptr_conv.is_owned = false;
53329         LDKNodeAnnouncementInfo val_conv;
53330         val_conv.inner = untag_ptr(val);
53331         val_conv.is_owned = ptr_is_owned(val);
53332         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53333         val_conv = NodeAnnouncementInfo_clone(&val_conv);
53334         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
53335 }
53336
53337 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
53338         LDKCVec_u64Z channels_arg_constr;
53339         channels_arg_constr.datalen = channels_arg->arr_len;
53340         if (channels_arg_constr.datalen > 0)
53341                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53342         else
53343                 channels_arg_constr.data = NULL;
53344         int64_t* channels_arg_vals = channels_arg->elems;
53345         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
53346                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
53347                 channels_arg_constr.data[i] = channels_arg_conv_8;
53348         }
53349         FREE(channels_arg);
53350         LDKNodeAnnouncementInfo announcement_info_arg_conv;
53351         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
53352         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
53353         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
53354         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
53355         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
53356         uint64_t ret_ref = 0;
53357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53359         return ret_ref;
53360 }
53361
53362 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
53363         LDKNodeInfo ret_var = NodeInfo_clone(arg);
53364         uint64_t ret_ref = 0;
53365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53367         return ret_ref;
53368 }
53369 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
53370         LDKNodeInfo arg_conv;
53371         arg_conv.inner = untag_ptr(arg);
53372         arg_conv.is_owned = ptr_is_owned(arg);
53373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53374         arg_conv.is_owned = false;
53375         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
53376         return ret_conv;
53377 }
53378
53379 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
53380         LDKNodeInfo orig_conv;
53381         orig_conv.inner = untag_ptr(orig);
53382         orig_conv.is_owned = ptr_is_owned(orig);
53383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53384         orig_conv.is_owned = false;
53385         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
53386         uint64_t ret_ref = 0;
53387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53389         return ret_ref;
53390 }
53391
53392 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
53393         LDKNodeInfo a_conv;
53394         a_conv.inner = untag_ptr(a);
53395         a_conv.is_owned = ptr_is_owned(a);
53396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53397         a_conv.is_owned = false;
53398         LDKNodeInfo b_conv;
53399         b_conv.inner = untag_ptr(b);
53400         b_conv.is_owned = ptr_is_owned(b);
53401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53402         b_conv.is_owned = false;
53403         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
53404         return ret_conv;
53405 }
53406
53407 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
53408         LDKNodeInfo obj_conv;
53409         obj_conv.inner = untag_ptr(obj);
53410         obj_conv.is_owned = ptr_is_owned(obj);
53411         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53412         obj_conv.is_owned = false;
53413         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
53414         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53415         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53416         CVec_u8Z_free(ret_var);
53417         return ret_arr;
53418 }
53419
53420 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
53421         LDKu8slice ser_ref;
53422         ser_ref.datalen = ser->arr_len;
53423         ser_ref.data = ser->elems;
53424         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
53425         *ret_conv = NodeInfo_read(ser_ref);
53426         FREE(ser);
53427         return tag_ptr(ret_conv, true);
53428 }
53429
53430 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
53431         LDKNetworkGraph obj_conv;
53432         obj_conv.inner = untag_ptr(obj);
53433         obj_conv.is_owned = ptr_is_owned(obj);
53434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53435         obj_conv.is_owned = false;
53436         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
53437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53439         CVec_u8Z_free(ret_var);
53440         return ret_arr;
53441 }
53442
53443 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
53444         LDKu8slice ser_ref;
53445         ser_ref.datalen = ser->arr_len;
53446         ser_ref.data = ser->elems;
53447         void* arg_ptr = untag_ptr(arg);
53448         CHECK_ACCESS(arg_ptr);
53449         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
53450         if (arg_conv.free == LDKLogger_JCalls_free) {
53451                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53452                 LDKLogger_JCalls_cloned(&arg_conv);
53453         }
53454         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
53455         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
53456         FREE(ser);
53457         return tag_ptr(ret_conv, true);
53458 }
53459
53460 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
53461         LDKNetwork network_conv = LDKNetwork_from_js(network);
53462         void* logger_ptr = untag_ptr(logger);
53463         CHECK_ACCESS(logger_ptr);
53464         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53465         if (logger_conv.free == LDKLogger_JCalls_free) {
53466                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53467                 LDKLogger_JCalls_cloned(&logger_conv);
53468         }
53469         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
53470         uint64_t ret_ref = 0;
53471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53473         return ret_ref;
53474 }
53475
53476 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
53477         LDKNetworkGraph this_arg_conv;
53478         this_arg_conv.inner = untag_ptr(this_arg);
53479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53481         this_arg_conv.is_owned = false;
53482         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
53483         uint64_t ret_ref = 0;
53484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53486         return ret_ref;
53487 }
53488
53489 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) {
53490         LDKNetworkGraph this_arg_conv;
53491         this_arg_conv.inner = untag_ptr(this_arg);
53492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53494         this_arg_conv.is_owned = false;
53495         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
53496         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
53497         uint64_t ret_ref = tag_ptr(ret_copy, true);
53498         return ret_ref;
53499 }
53500
53501 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) {
53502         LDKNetworkGraph this_arg_conv;
53503         this_arg_conv.inner = untag_ptr(this_arg);
53504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53506         this_arg_conv.is_owned = false;
53507         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
53508 }
53509
53510 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
53511         LDKNetworkGraph this_arg_conv;
53512         this_arg_conv.inner = untag_ptr(this_arg);
53513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53515         this_arg_conv.is_owned = false;
53516         LDKNodeAnnouncement msg_conv;
53517         msg_conv.inner = untag_ptr(msg);
53518         msg_conv.is_owned = ptr_is_owned(msg);
53519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53520         msg_conv.is_owned = false;
53521         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53522         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
53523         return tag_ptr(ret_conv, true);
53524 }
53525
53526 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) {
53527         LDKNetworkGraph this_arg_conv;
53528         this_arg_conv.inner = untag_ptr(this_arg);
53529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53531         this_arg_conv.is_owned = false;
53532         LDKUnsignedNodeAnnouncement msg_conv;
53533         msg_conv.inner = untag_ptr(msg);
53534         msg_conv.is_owned = ptr_is_owned(msg);
53535         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53536         msg_conv.is_owned = false;
53537         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53538         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
53539         return tag_ptr(ret_conv, true);
53540 }
53541
53542 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) {
53543         LDKNetworkGraph this_arg_conv;
53544         this_arg_conv.inner = untag_ptr(this_arg);
53545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53547         this_arg_conv.is_owned = false;
53548         LDKChannelAnnouncement msg_conv;
53549         msg_conv.inner = untag_ptr(msg);
53550         msg_conv.is_owned = ptr_is_owned(msg);
53551         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53552         msg_conv.is_owned = false;
53553         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
53554         CHECK_ACCESS(utxo_lookup_ptr);
53555         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
53556         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
53557         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
53558                 // Manually implement clone for Java trait instances
53559                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
53560                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53561                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
53562                 }
53563         }
53564         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53565         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
53566         return tag_ptr(ret_conv, true);
53567 }
53568
53569 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) {
53570         LDKNetworkGraph this_arg_conv;
53571         this_arg_conv.inner = untag_ptr(this_arg);
53572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53574         this_arg_conv.is_owned = false;
53575         LDKChannelAnnouncement msg_conv;
53576         msg_conv.inner = untag_ptr(msg);
53577         msg_conv.is_owned = ptr_is_owned(msg);
53578         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53579         msg_conv.is_owned = false;
53580         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53581         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
53582         return tag_ptr(ret_conv, true);
53583 }
53584
53585 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) {
53586         LDKNetworkGraph this_arg_conv;
53587         this_arg_conv.inner = untag_ptr(this_arg);
53588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53590         this_arg_conv.is_owned = false;
53591         LDKUnsignedChannelAnnouncement msg_conv;
53592         msg_conv.inner = untag_ptr(msg);
53593         msg_conv.is_owned = ptr_is_owned(msg);
53594         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53595         msg_conv.is_owned = false;
53596         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
53597         CHECK_ACCESS(utxo_lookup_ptr);
53598         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
53599         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
53600         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
53601                 // Manually implement clone for Java trait instances
53602                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
53603                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53604                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
53605                 }
53606         }
53607         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53608         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
53609         return tag_ptr(ret_conv, true);
53610 }
53611
53612 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) {
53613         LDKNetworkGraph this_arg_conv;
53614         this_arg_conv.inner = untag_ptr(this_arg);
53615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53617         this_arg_conv.is_owned = false;
53618         LDKChannelFeatures features_conv;
53619         features_conv.inner = untag_ptr(features);
53620         features_conv.is_owned = ptr_is_owned(features);
53621         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
53622         features_conv = ChannelFeatures_clone(&features_conv);
53623         LDKPublicKey node_id_1_ref;
53624         CHECK(node_id_1->arr_len == 33);
53625         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
53626         LDKPublicKey node_id_2_ref;
53627         CHECK(node_id_2->arr_len == 33);
53628         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
53629         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53630         *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);
53631         return tag_ptr(ret_conv, true);
53632 }
53633
53634 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
53635         LDKNetworkGraph this_arg_conv;
53636         this_arg_conv.inner = untag_ptr(this_arg);
53637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53639         this_arg_conv.is_owned = false;
53640         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
53641 }
53642
53643 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
53644         LDKNetworkGraph this_arg_conv;
53645         this_arg_conv.inner = untag_ptr(this_arg);
53646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53648         this_arg_conv.is_owned = false;
53649         LDKPublicKey node_id_ref;
53650         CHECK(node_id->arr_len == 33);
53651         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
53652         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
53653 }
53654
53655 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) {
53656         LDKNetworkGraph this_arg_conv;
53657         this_arg_conv.inner = untag_ptr(this_arg);
53658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53660         this_arg_conv.is_owned = false;
53661         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
53662 }
53663
53664 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
53665         LDKNetworkGraph this_arg_conv;
53666         this_arg_conv.inner = untag_ptr(this_arg);
53667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53669         this_arg_conv.is_owned = false;
53670         LDKChannelUpdate msg_conv;
53671         msg_conv.inner = untag_ptr(msg);
53672         msg_conv.is_owned = ptr_is_owned(msg);
53673         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53674         msg_conv.is_owned = false;
53675         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53676         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
53677         return tag_ptr(ret_conv, true);
53678 }
53679
53680 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
53681         LDKNetworkGraph this_arg_conv;
53682         this_arg_conv.inner = untag_ptr(this_arg);
53683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53685         this_arg_conv.is_owned = false;
53686         LDKUnsignedChannelUpdate msg_conv;
53687         msg_conv.inner = untag_ptr(msg);
53688         msg_conv.is_owned = ptr_is_owned(msg);
53689         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53690         msg_conv.is_owned = false;
53691         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53692         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
53693         return tag_ptr(ret_conv, true);
53694 }
53695
53696 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
53697         LDKReadOnlyNetworkGraph this_arg_conv;
53698         this_arg_conv.inner = untag_ptr(this_arg);
53699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53701         this_arg_conv.is_owned = false;
53702         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
53703         uint64_t ret_ref = 0;
53704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53706         return ret_ref;
53707 }
53708
53709 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
53710         LDKReadOnlyNetworkGraph this_arg_conv;
53711         this_arg_conv.inner = untag_ptr(this_arg);
53712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53714         this_arg_conv.is_owned = false;
53715         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
53716         int64_tArray ret_arr = NULL;
53717         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53718         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53719         for (size_t i = 0; i < ret_var.datalen; i++) {
53720                 int64_t ret_conv_8_conv = ret_var.data[i];
53721                 ret_arr_ptr[i] = ret_conv_8_conv;
53722         }
53723         
53724         FREE(ret_var.data);
53725         return ret_arr;
53726 }
53727
53728 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
53729         LDKReadOnlyNetworkGraph this_arg_conv;
53730         this_arg_conv.inner = untag_ptr(this_arg);
53731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53733         this_arg_conv.is_owned = false;
53734         LDKNodeId node_id_conv;
53735         node_id_conv.inner = untag_ptr(node_id);
53736         node_id_conv.is_owned = ptr_is_owned(node_id);
53737         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
53738         node_id_conv.is_owned = false;
53739         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
53740         uint64_t ret_ref = 0;
53741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53743         return ret_ref;
53744 }
53745
53746 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
53747         LDKReadOnlyNetworkGraph this_arg_conv;
53748         this_arg_conv.inner = untag_ptr(this_arg);
53749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53751         this_arg_conv.is_owned = false;
53752         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
53753         uint64_tArray ret_arr = NULL;
53754         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53755         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53756         for (size_t i = 0; i < ret_var.datalen; i++) {
53757                 LDKNodeId ret_conv_8_var = ret_var.data[i];
53758                 uint64_t ret_conv_8_ref = 0;
53759                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
53760                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
53761                 ret_arr_ptr[i] = ret_conv_8_ref;
53762         }
53763         
53764         FREE(ret_var.data);
53765         return ret_arr;
53766 }
53767
53768 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
53769         LDKReadOnlyNetworkGraph this_arg_conv;
53770         this_arg_conv.inner = untag_ptr(this_arg);
53771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53773         this_arg_conv.is_owned = false;
53774         LDKPublicKey pubkey_ref;
53775         CHECK(pubkey->arr_len == 33);
53776         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
53777         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
53778         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
53779         uint64_t ret_ref = tag_ptr(ret_copy, true);
53780         return ret_ref;
53781 }
53782
53783 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
53784         LDKDefaultRouter this_obj_conv;
53785         this_obj_conv.inner = untag_ptr(this_obj);
53786         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53788         DefaultRouter_free(this_obj_conv);
53789 }
53790
53791 uint64_t  __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes, uint64_t scorer, uint64_t score_params) {
53792         LDKNetworkGraph network_graph_conv;
53793         network_graph_conv.inner = untag_ptr(network_graph);
53794         network_graph_conv.is_owned = ptr_is_owned(network_graph);
53795         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
53796         network_graph_conv.is_owned = false;
53797         void* logger_ptr = untag_ptr(logger);
53798         CHECK_ACCESS(logger_ptr);
53799         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53800         if (logger_conv.free == LDKLogger_JCalls_free) {
53801                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53802                 LDKLogger_JCalls_cloned(&logger_conv);
53803         }
53804         LDKThirtyTwoBytes random_seed_bytes_ref;
53805         CHECK(random_seed_bytes->arr_len == 32);
53806         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
53807         void* scorer_ptr = untag_ptr(scorer);
53808         CHECK_ACCESS(scorer_ptr);
53809         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
53810         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
53811                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53812                 LDKLockableScore_JCalls_cloned(&scorer_conv);
53813         }
53814         LDKProbabilisticScoringFeeParameters score_params_conv;
53815         score_params_conv.inner = untag_ptr(score_params);
53816         score_params_conv.is_owned = ptr_is_owned(score_params);
53817         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
53818         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
53819         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
53820         uint64_t ret_ref = 0;
53821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53823         return ret_ref;
53824 }
53825
53826 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
53827         LDKDefaultRouter this_arg_conv;
53828         this_arg_conv.inner = untag_ptr(this_arg);
53829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53831         this_arg_conv.is_owned = false;
53832         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
53833         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
53834         return tag_ptr(ret_ret, true);
53835 }
53836
53837 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
53838         if (!ptr_is_owned(this_ptr)) return;
53839         void* this_ptr_ptr = untag_ptr(this_ptr);
53840         CHECK_ACCESS(this_ptr_ptr);
53841         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
53842         FREE(untag_ptr(this_ptr));
53843         Router_free(this_ptr_conv);
53844 }
53845
53846 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
53847         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
53848         this_obj_conv.inner = untag_ptr(this_obj);
53849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53851         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
53852 }
53853
53854 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
53855         void* scorer_ptr = untag_ptr(scorer);
53856         CHECK_ACCESS(scorer_ptr);
53857         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
53858         if (scorer_conv.free == LDKScore_JCalls_free) {
53859                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53860                 LDKScore_JCalls_cloned(&scorer_conv);
53861         }
53862         LDKInFlightHtlcs inflight_htlcs_conv;
53863         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
53864         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
53865         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
53866         inflight_htlcs_conv.is_owned = false;
53867         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
53868         uint64_t ret_ref = 0;
53869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53871         return ret_ref;
53872 }
53873
53874 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
53875         LDKScorerAccountingForInFlightHtlcs obj_conv;
53876         obj_conv.inner = untag_ptr(obj);
53877         obj_conv.is_owned = ptr_is_owned(obj);
53878         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53879         obj_conv.is_owned = false;
53880         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
53881         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53882         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53883         CVec_u8Z_free(ret_var);
53884         return ret_arr;
53885 }
53886
53887 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
53888         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
53889         this_arg_conv.inner = untag_ptr(this_arg);
53890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53892         this_arg_conv.is_owned = false;
53893         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
53894         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
53895         return tag_ptr(ret_ret, true);
53896 }
53897
53898 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
53899         LDKInFlightHtlcs this_obj_conv;
53900         this_obj_conv.inner = untag_ptr(this_obj);
53901         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53903         InFlightHtlcs_free(this_obj_conv);
53904 }
53905
53906 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
53907         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
53908         uint64_t ret_ref = 0;
53909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53911         return ret_ref;
53912 }
53913 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
53914         LDKInFlightHtlcs arg_conv;
53915         arg_conv.inner = untag_ptr(arg);
53916         arg_conv.is_owned = ptr_is_owned(arg);
53917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53918         arg_conv.is_owned = false;
53919         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
53920         return ret_conv;
53921 }
53922
53923 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
53924         LDKInFlightHtlcs orig_conv;
53925         orig_conv.inner = untag_ptr(orig);
53926         orig_conv.is_owned = ptr_is_owned(orig);
53927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53928         orig_conv.is_owned = false;
53929         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
53930         uint64_t ret_ref = 0;
53931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53933         return ret_ref;
53934 }
53935
53936 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
53937         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
53938         uint64_t ret_ref = 0;
53939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53941         return ret_ref;
53942 }
53943
53944 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
53945         LDKInFlightHtlcs this_arg_conv;
53946         this_arg_conv.inner = untag_ptr(this_arg);
53947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53949         this_arg_conv.is_owned = false;
53950         LDKPath path_conv;
53951         path_conv.inner = untag_ptr(path);
53952         path_conv.is_owned = ptr_is_owned(path);
53953         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
53954         path_conv.is_owned = false;
53955         LDKPublicKey payer_node_id_ref;
53956         CHECK(payer_node_id->arr_len == 33);
53957         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
53958         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
53959 }
53960
53961 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) {
53962         LDKInFlightHtlcs this_arg_conv;
53963         this_arg_conv.inner = untag_ptr(this_arg);
53964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53966         this_arg_conv.is_owned = false;
53967         LDKNodeId source_conv;
53968         source_conv.inner = untag_ptr(source);
53969         source_conv.is_owned = ptr_is_owned(source);
53970         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
53971         source_conv.is_owned = false;
53972         LDKNodeId target_conv;
53973         target_conv.inner = untag_ptr(target);
53974         target_conv.is_owned = ptr_is_owned(target);
53975         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
53976         target_conv.is_owned = false;
53977         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
53978 }
53979
53980 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) {
53981         LDKInFlightHtlcs this_arg_conv;
53982         this_arg_conv.inner = untag_ptr(this_arg);
53983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53985         this_arg_conv.is_owned = false;
53986         LDKNodeId source_conv;
53987         source_conv.inner = untag_ptr(source);
53988         source_conv.is_owned = ptr_is_owned(source);
53989         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
53990         source_conv.is_owned = false;
53991         LDKNodeId target_conv;
53992         target_conv.inner = untag_ptr(target);
53993         target_conv.is_owned = ptr_is_owned(target);
53994         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
53995         target_conv.is_owned = false;
53996         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53997         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
53998         uint64_t ret_ref = tag_ptr(ret_copy, true);
53999         return ret_ref;
54000 }
54001
54002 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
54003         LDKInFlightHtlcs obj_conv;
54004         obj_conv.inner = untag_ptr(obj);
54005         obj_conv.is_owned = ptr_is_owned(obj);
54006         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54007         obj_conv.is_owned = false;
54008         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
54009         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54010         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54011         CVec_u8Z_free(ret_var);
54012         return ret_arr;
54013 }
54014
54015 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
54016         LDKu8slice ser_ref;
54017         ser_ref.datalen = ser->arr_len;
54018         ser_ref.data = ser->elems;
54019         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
54020         *ret_conv = InFlightHtlcs_read(ser_ref);
54021         FREE(ser);
54022         return tag_ptr(ret_conv, true);
54023 }
54024
54025 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
54026         LDKRouteHop this_obj_conv;
54027         this_obj_conv.inner = untag_ptr(this_obj);
54028         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54030         RouteHop_free(this_obj_conv);
54031 }
54032
54033 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
54034         LDKRouteHop this_ptr_conv;
54035         this_ptr_conv.inner = untag_ptr(this_ptr);
54036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54038         this_ptr_conv.is_owned = false;
54039         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54040         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
54041         return ret_arr;
54042 }
54043
54044 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
54045         LDKRouteHop this_ptr_conv;
54046         this_ptr_conv.inner = untag_ptr(this_ptr);
54047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54049         this_ptr_conv.is_owned = false;
54050         LDKPublicKey val_ref;
54051         CHECK(val->arr_len == 33);
54052         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
54053         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
54054 }
54055
54056 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
54057         LDKRouteHop this_ptr_conv;
54058         this_ptr_conv.inner = untag_ptr(this_ptr);
54059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54061         this_ptr_conv.is_owned = false;
54062         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
54063         uint64_t ret_ref = 0;
54064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54066         return ret_ref;
54067 }
54068
54069 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
54070         LDKRouteHop this_ptr_conv;
54071         this_ptr_conv.inner = untag_ptr(this_ptr);
54072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54074         this_ptr_conv.is_owned = false;
54075         LDKNodeFeatures val_conv;
54076         val_conv.inner = untag_ptr(val);
54077         val_conv.is_owned = ptr_is_owned(val);
54078         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54079         val_conv = NodeFeatures_clone(&val_conv);
54080         RouteHop_set_node_features(&this_ptr_conv, val_conv);
54081 }
54082
54083 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
54084         LDKRouteHop this_ptr_conv;
54085         this_ptr_conv.inner = untag_ptr(this_ptr);
54086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54088         this_ptr_conv.is_owned = false;
54089         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
54090         return ret_conv;
54091 }
54092
54093 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
54094         LDKRouteHop this_ptr_conv;
54095         this_ptr_conv.inner = untag_ptr(this_ptr);
54096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54098         this_ptr_conv.is_owned = false;
54099         RouteHop_set_short_channel_id(&this_ptr_conv, val);
54100 }
54101
54102 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
54103         LDKRouteHop this_ptr_conv;
54104         this_ptr_conv.inner = untag_ptr(this_ptr);
54105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54107         this_ptr_conv.is_owned = false;
54108         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
54109         uint64_t ret_ref = 0;
54110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54112         return ret_ref;
54113 }
54114
54115 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
54116         LDKRouteHop this_ptr_conv;
54117         this_ptr_conv.inner = untag_ptr(this_ptr);
54118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54120         this_ptr_conv.is_owned = false;
54121         LDKChannelFeatures val_conv;
54122         val_conv.inner = untag_ptr(val);
54123         val_conv.is_owned = ptr_is_owned(val);
54124         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54125         val_conv = ChannelFeatures_clone(&val_conv);
54126         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
54127 }
54128
54129 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
54130         LDKRouteHop this_ptr_conv;
54131         this_ptr_conv.inner = untag_ptr(this_ptr);
54132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54134         this_ptr_conv.is_owned = false;
54135         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
54136         return ret_conv;
54137 }
54138
54139 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
54140         LDKRouteHop this_ptr_conv;
54141         this_ptr_conv.inner = untag_ptr(this_ptr);
54142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54144         this_ptr_conv.is_owned = false;
54145         RouteHop_set_fee_msat(&this_ptr_conv, val);
54146 }
54147
54148 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
54149         LDKRouteHop 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         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
54155         return ret_conv;
54156 }
54157
54158 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
54159         LDKRouteHop this_ptr_conv;
54160         this_ptr_conv.inner = untag_ptr(this_ptr);
54161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54163         this_ptr_conv.is_owned = false;
54164         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
54165 }
54166
54167 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) {
54168         LDKPublicKey pubkey_arg_ref;
54169         CHECK(pubkey_arg->arr_len == 33);
54170         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
54171         LDKNodeFeatures node_features_arg_conv;
54172         node_features_arg_conv.inner = untag_ptr(node_features_arg);
54173         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
54174         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
54175         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
54176         LDKChannelFeatures channel_features_arg_conv;
54177         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
54178         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
54179         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
54180         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
54181         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);
54182         uint64_t ret_ref = 0;
54183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54185         return ret_ref;
54186 }
54187
54188 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
54189         LDKRouteHop ret_var = RouteHop_clone(arg);
54190         uint64_t ret_ref = 0;
54191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54193         return ret_ref;
54194 }
54195 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
54196         LDKRouteHop arg_conv;
54197         arg_conv.inner = untag_ptr(arg);
54198         arg_conv.is_owned = ptr_is_owned(arg);
54199         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54200         arg_conv.is_owned = false;
54201         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
54202         return ret_conv;
54203 }
54204
54205 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
54206         LDKRouteHop orig_conv;
54207         orig_conv.inner = untag_ptr(orig);
54208         orig_conv.is_owned = ptr_is_owned(orig);
54209         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54210         orig_conv.is_owned = false;
54211         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
54212         uint64_t ret_ref = 0;
54213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54215         return ret_ref;
54216 }
54217
54218 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
54219         LDKRouteHop o_conv;
54220         o_conv.inner = untag_ptr(o);
54221         o_conv.is_owned = ptr_is_owned(o);
54222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54223         o_conv.is_owned = false;
54224         int64_t ret_conv = RouteHop_hash(&o_conv);
54225         return ret_conv;
54226 }
54227
54228 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
54229         LDKRouteHop a_conv;
54230         a_conv.inner = untag_ptr(a);
54231         a_conv.is_owned = ptr_is_owned(a);
54232         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54233         a_conv.is_owned = false;
54234         LDKRouteHop b_conv;
54235         b_conv.inner = untag_ptr(b);
54236         b_conv.is_owned = ptr_is_owned(b);
54237         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54238         b_conv.is_owned = false;
54239         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
54240         return ret_conv;
54241 }
54242
54243 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
54244         LDKRouteHop obj_conv;
54245         obj_conv.inner = untag_ptr(obj);
54246         obj_conv.is_owned = ptr_is_owned(obj);
54247         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54248         obj_conv.is_owned = false;
54249         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
54250         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54251         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54252         CVec_u8Z_free(ret_var);
54253         return ret_arr;
54254 }
54255
54256 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
54257         LDKu8slice ser_ref;
54258         ser_ref.datalen = ser->arr_len;
54259         ser_ref.data = ser->elems;
54260         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
54261         *ret_conv = RouteHop_read(ser_ref);
54262         FREE(ser);
54263         return tag_ptr(ret_conv, true);
54264 }
54265
54266 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
54267         LDKBlindedTail this_obj_conv;
54268         this_obj_conv.inner = untag_ptr(this_obj);
54269         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54271         BlindedTail_free(this_obj_conv);
54272 }
54273
54274 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
54275         LDKBlindedTail this_ptr_conv;
54276         this_ptr_conv.inner = untag_ptr(this_ptr);
54277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54279         this_ptr_conv.is_owned = false;
54280         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
54281         uint64_tArray ret_arr = NULL;
54282         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54283         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54284         for (size_t m = 0; m < ret_var.datalen; m++) {
54285                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
54286                 uint64_t ret_conv_12_ref = 0;
54287                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
54288                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
54289                 ret_arr_ptr[m] = ret_conv_12_ref;
54290         }
54291         
54292         FREE(ret_var.data);
54293         return ret_arr;
54294 }
54295
54296 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
54297         LDKBlindedTail this_ptr_conv;
54298         this_ptr_conv.inner = untag_ptr(this_ptr);
54299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54301         this_ptr_conv.is_owned = false;
54302         LDKCVec_BlindedHopZ val_constr;
54303         val_constr.datalen = val->arr_len;
54304         if (val_constr.datalen > 0)
54305                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
54306         else
54307                 val_constr.data = NULL;
54308         uint64_t* val_vals = val->elems;
54309         for (size_t m = 0; m < val_constr.datalen; m++) {
54310                 uint64_t val_conv_12 = val_vals[m];
54311                 LDKBlindedHop val_conv_12_conv;
54312                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
54313                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
54314                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
54315                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
54316                 val_constr.data[m] = val_conv_12_conv;
54317         }
54318         FREE(val);
54319         BlindedTail_set_hops(&this_ptr_conv, val_constr);
54320 }
54321
54322 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
54323         LDKBlindedTail this_ptr_conv;
54324         this_ptr_conv.inner = untag_ptr(this_ptr);
54325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54327         this_ptr_conv.is_owned = false;
54328         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54329         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
54330         return ret_arr;
54331 }
54332
54333 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
54334         LDKBlindedTail this_ptr_conv;
54335         this_ptr_conv.inner = untag_ptr(this_ptr);
54336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54338         this_ptr_conv.is_owned = false;
54339         LDKPublicKey val_ref;
54340         CHECK(val->arr_len == 33);
54341         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
54342         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
54343 }
54344
54345 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) {
54346         LDKBlindedTail this_ptr_conv;
54347         this_ptr_conv.inner = untag_ptr(this_ptr);
54348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54350         this_ptr_conv.is_owned = false;
54351         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
54352         return ret_conv;
54353 }
54354
54355 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) {
54356         LDKBlindedTail this_ptr_conv;
54357         this_ptr_conv.inner = untag_ptr(this_ptr);
54358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54360         this_ptr_conv.is_owned = false;
54361         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
54362 }
54363
54364 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
54365         LDKBlindedTail this_ptr_conv;
54366         this_ptr_conv.inner = untag_ptr(this_ptr);
54367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54369         this_ptr_conv.is_owned = false;
54370         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
54371         return ret_conv;
54372 }
54373
54374 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
54375         LDKBlindedTail this_ptr_conv;
54376         this_ptr_conv.inner = untag_ptr(this_ptr);
54377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54379         this_ptr_conv.is_owned = false;
54380         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
54381 }
54382
54383 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) {
54384         LDKCVec_BlindedHopZ hops_arg_constr;
54385         hops_arg_constr.datalen = hops_arg->arr_len;
54386         if (hops_arg_constr.datalen > 0)
54387                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
54388         else
54389                 hops_arg_constr.data = NULL;
54390         uint64_t* hops_arg_vals = hops_arg->elems;
54391         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
54392                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
54393                 LDKBlindedHop hops_arg_conv_12_conv;
54394                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
54395                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
54396                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
54397                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
54398                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
54399         }
54400         FREE(hops_arg);
54401         LDKPublicKey blinding_point_arg_ref;
54402         CHECK(blinding_point_arg->arr_len == 33);
54403         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
54404         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
54405         uint64_t ret_ref = 0;
54406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54408         return ret_ref;
54409 }
54410
54411 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
54412         LDKBlindedTail ret_var = BlindedTail_clone(arg);
54413         uint64_t ret_ref = 0;
54414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54416         return ret_ref;
54417 }
54418 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
54419         LDKBlindedTail arg_conv;
54420         arg_conv.inner = untag_ptr(arg);
54421         arg_conv.is_owned = ptr_is_owned(arg);
54422         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54423         arg_conv.is_owned = false;
54424         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
54425         return ret_conv;
54426 }
54427
54428 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
54429         LDKBlindedTail orig_conv;
54430         orig_conv.inner = untag_ptr(orig);
54431         orig_conv.is_owned = ptr_is_owned(orig);
54432         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54433         orig_conv.is_owned = false;
54434         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
54435         uint64_t ret_ref = 0;
54436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54438         return ret_ref;
54439 }
54440
54441 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
54442         LDKBlindedTail o_conv;
54443         o_conv.inner = untag_ptr(o);
54444         o_conv.is_owned = ptr_is_owned(o);
54445         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54446         o_conv.is_owned = false;
54447         int64_t ret_conv = BlindedTail_hash(&o_conv);
54448         return ret_conv;
54449 }
54450
54451 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
54452         LDKBlindedTail a_conv;
54453         a_conv.inner = untag_ptr(a);
54454         a_conv.is_owned = ptr_is_owned(a);
54455         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54456         a_conv.is_owned = false;
54457         LDKBlindedTail b_conv;
54458         b_conv.inner = untag_ptr(b);
54459         b_conv.is_owned = ptr_is_owned(b);
54460         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54461         b_conv.is_owned = false;
54462         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
54463         return ret_conv;
54464 }
54465
54466 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
54467         LDKBlindedTail obj_conv;
54468         obj_conv.inner = untag_ptr(obj);
54469         obj_conv.is_owned = ptr_is_owned(obj);
54470         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54471         obj_conv.is_owned = false;
54472         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
54473         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54474         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54475         CVec_u8Z_free(ret_var);
54476         return ret_arr;
54477 }
54478
54479 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
54480         LDKu8slice ser_ref;
54481         ser_ref.datalen = ser->arr_len;
54482         ser_ref.data = ser->elems;
54483         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
54484         *ret_conv = BlindedTail_read(ser_ref);
54485         FREE(ser);
54486         return tag_ptr(ret_conv, true);
54487 }
54488
54489 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
54490         LDKPath this_obj_conv;
54491         this_obj_conv.inner = untag_ptr(this_obj);
54492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54494         Path_free(this_obj_conv);
54495 }
54496
54497 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
54498         LDKPath this_ptr_conv;
54499         this_ptr_conv.inner = untag_ptr(this_ptr);
54500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54502         this_ptr_conv.is_owned = false;
54503         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
54504         uint64_tArray ret_arr = NULL;
54505         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54506         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54507         for (size_t k = 0; k < ret_var.datalen; k++) {
54508                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
54509                 uint64_t ret_conv_10_ref = 0;
54510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
54511                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
54512                 ret_arr_ptr[k] = ret_conv_10_ref;
54513         }
54514         
54515         FREE(ret_var.data);
54516         return ret_arr;
54517 }
54518
54519 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
54520         LDKPath this_ptr_conv;
54521         this_ptr_conv.inner = untag_ptr(this_ptr);
54522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54524         this_ptr_conv.is_owned = false;
54525         LDKCVec_RouteHopZ val_constr;
54526         val_constr.datalen = val->arr_len;
54527         if (val_constr.datalen > 0)
54528                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
54529         else
54530                 val_constr.data = NULL;
54531         uint64_t* val_vals = val->elems;
54532         for (size_t k = 0; k < val_constr.datalen; k++) {
54533                 uint64_t val_conv_10 = val_vals[k];
54534                 LDKRouteHop val_conv_10_conv;
54535                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
54536                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
54537                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
54538                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
54539                 val_constr.data[k] = val_conv_10_conv;
54540         }
54541         FREE(val);
54542         Path_set_hops(&this_ptr_conv, val_constr);
54543 }
54544
54545 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
54546         LDKPath this_ptr_conv;
54547         this_ptr_conv.inner = untag_ptr(this_ptr);
54548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54550         this_ptr_conv.is_owned = false;
54551         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
54552         uint64_t ret_ref = 0;
54553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54555         return ret_ref;
54556 }
54557
54558 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
54559         LDKPath this_ptr_conv;
54560         this_ptr_conv.inner = untag_ptr(this_ptr);
54561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54563         this_ptr_conv.is_owned = false;
54564         LDKBlindedTail val_conv;
54565         val_conv.inner = untag_ptr(val);
54566         val_conv.is_owned = ptr_is_owned(val);
54567         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54568         val_conv = BlindedTail_clone(&val_conv);
54569         Path_set_blinded_tail(&this_ptr_conv, val_conv);
54570 }
54571
54572 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
54573         LDKCVec_RouteHopZ hops_arg_constr;
54574         hops_arg_constr.datalen = hops_arg->arr_len;
54575         if (hops_arg_constr.datalen > 0)
54576                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
54577         else
54578                 hops_arg_constr.data = NULL;
54579         uint64_t* hops_arg_vals = hops_arg->elems;
54580         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
54581                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
54582                 LDKRouteHop hops_arg_conv_10_conv;
54583                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
54584                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
54585                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
54586                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
54587                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
54588         }
54589         FREE(hops_arg);
54590         LDKBlindedTail blinded_tail_arg_conv;
54591         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
54592         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
54593         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
54594         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
54595         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
54596         uint64_t ret_ref = 0;
54597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54599         return ret_ref;
54600 }
54601
54602 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
54603         LDKPath ret_var = Path_clone(arg);
54604         uint64_t ret_ref = 0;
54605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54607         return ret_ref;
54608 }
54609 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
54610         LDKPath arg_conv;
54611         arg_conv.inner = untag_ptr(arg);
54612         arg_conv.is_owned = ptr_is_owned(arg);
54613         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54614         arg_conv.is_owned = false;
54615         int64_t ret_conv = Path_clone_ptr(&arg_conv);
54616         return ret_conv;
54617 }
54618
54619 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
54620         LDKPath orig_conv;
54621         orig_conv.inner = untag_ptr(orig);
54622         orig_conv.is_owned = ptr_is_owned(orig);
54623         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54624         orig_conv.is_owned = false;
54625         LDKPath ret_var = Path_clone(&orig_conv);
54626         uint64_t ret_ref = 0;
54627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54629         return ret_ref;
54630 }
54631
54632 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
54633         LDKPath o_conv;
54634         o_conv.inner = untag_ptr(o);
54635         o_conv.is_owned = ptr_is_owned(o);
54636         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54637         o_conv.is_owned = false;
54638         int64_t ret_conv = Path_hash(&o_conv);
54639         return ret_conv;
54640 }
54641
54642 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
54643         LDKPath a_conv;
54644         a_conv.inner = untag_ptr(a);
54645         a_conv.is_owned = ptr_is_owned(a);
54646         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54647         a_conv.is_owned = false;
54648         LDKPath b_conv;
54649         b_conv.inner = untag_ptr(b);
54650         b_conv.is_owned = ptr_is_owned(b);
54651         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54652         b_conv.is_owned = false;
54653         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
54654         return ret_conv;
54655 }
54656
54657 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
54658         LDKPath this_arg_conv;
54659         this_arg_conv.inner = untag_ptr(this_arg);
54660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54662         this_arg_conv.is_owned = false;
54663         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
54664         return ret_conv;
54665 }
54666
54667 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
54668         LDKPath this_arg_conv;
54669         this_arg_conv.inner = untag_ptr(this_arg);
54670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54672         this_arg_conv.is_owned = false;
54673         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
54674         return ret_conv;
54675 }
54676
54677 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
54678         LDKPath this_arg_conv;
54679         this_arg_conv.inner = untag_ptr(this_arg);
54680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54682         this_arg_conv.is_owned = false;
54683         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
54684         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
54685         uint64_t ret_ref = tag_ptr(ret_copy, true);
54686         return ret_ref;
54687 }
54688
54689 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
54690         LDKRoute this_obj_conv;
54691         this_obj_conv.inner = untag_ptr(this_obj);
54692         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54694         Route_free(this_obj_conv);
54695 }
54696
54697 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
54698         LDKRoute this_ptr_conv;
54699         this_ptr_conv.inner = untag_ptr(this_ptr);
54700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54702         this_ptr_conv.is_owned = false;
54703         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
54704         uint64_tArray ret_arr = NULL;
54705         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54706         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54707         for (size_t g = 0; g < ret_var.datalen; g++) {
54708                 LDKPath ret_conv_6_var = ret_var.data[g];
54709                 uint64_t ret_conv_6_ref = 0;
54710                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
54711                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
54712                 ret_arr_ptr[g] = ret_conv_6_ref;
54713         }
54714         
54715         FREE(ret_var.data);
54716         return ret_arr;
54717 }
54718
54719 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
54720         LDKRoute this_ptr_conv;
54721         this_ptr_conv.inner = untag_ptr(this_ptr);
54722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54724         this_ptr_conv.is_owned = false;
54725         LDKCVec_PathZ val_constr;
54726         val_constr.datalen = val->arr_len;
54727         if (val_constr.datalen > 0)
54728                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
54729         else
54730                 val_constr.data = NULL;
54731         uint64_t* val_vals = val->elems;
54732         for (size_t g = 0; g < val_constr.datalen; g++) {
54733                 uint64_t val_conv_6 = val_vals[g];
54734                 LDKPath val_conv_6_conv;
54735                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
54736                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
54737                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
54738                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
54739                 val_constr.data[g] = val_conv_6_conv;
54740         }
54741         FREE(val);
54742         Route_set_paths(&this_ptr_conv, val_constr);
54743 }
54744
54745 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
54746         LDKRoute this_ptr_conv;
54747         this_ptr_conv.inner = untag_ptr(this_ptr);
54748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54750         this_ptr_conv.is_owned = false;
54751         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
54752         uint64_t ret_ref = 0;
54753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54755         return ret_ref;
54756 }
54757
54758 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
54759         LDKRoute this_ptr_conv;
54760         this_ptr_conv.inner = untag_ptr(this_ptr);
54761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54763         this_ptr_conv.is_owned = false;
54764         LDKPaymentParameters val_conv;
54765         val_conv.inner = untag_ptr(val);
54766         val_conv.is_owned = ptr_is_owned(val);
54767         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54768         val_conv = PaymentParameters_clone(&val_conv);
54769         Route_set_payment_params(&this_ptr_conv, val_conv);
54770 }
54771
54772 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t payment_params_arg) {
54773         LDKCVec_PathZ paths_arg_constr;
54774         paths_arg_constr.datalen = paths_arg->arr_len;
54775         if (paths_arg_constr.datalen > 0)
54776                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
54777         else
54778                 paths_arg_constr.data = NULL;
54779         uint64_t* paths_arg_vals = paths_arg->elems;
54780         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
54781                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
54782                 LDKPath paths_arg_conv_6_conv;
54783                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
54784                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
54785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
54786                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
54787                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
54788         }
54789         FREE(paths_arg);
54790         LDKPaymentParameters payment_params_arg_conv;
54791         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
54792         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
54793         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
54794         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
54795         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
54796         uint64_t ret_ref = 0;
54797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54799         return ret_ref;
54800 }
54801
54802 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
54803         LDKRoute ret_var = Route_clone(arg);
54804         uint64_t ret_ref = 0;
54805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54807         return ret_ref;
54808 }
54809 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
54810         LDKRoute arg_conv;
54811         arg_conv.inner = untag_ptr(arg);
54812         arg_conv.is_owned = ptr_is_owned(arg);
54813         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54814         arg_conv.is_owned = false;
54815         int64_t ret_conv = Route_clone_ptr(&arg_conv);
54816         return ret_conv;
54817 }
54818
54819 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
54820         LDKRoute orig_conv;
54821         orig_conv.inner = untag_ptr(orig);
54822         orig_conv.is_owned = ptr_is_owned(orig);
54823         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54824         orig_conv.is_owned = false;
54825         LDKRoute ret_var = Route_clone(&orig_conv);
54826         uint64_t ret_ref = 0;
54827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54829         return ret_ref;
54830 }
54831
54832 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
54833         LDKRoute o_conv;
54834         o_conv.inner = untag_ptr(o);
54835         o_conv.is_owned = ptr_is_owned(o);
54836         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54837         o_conv.is_owned = false;
54838         int64_t ret_conv = Route_hash(&o_conv);
54839         return ret_conv;
54840 }
54841
54842 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
54843         LDKRoute a_conv;
54844         a_conv.inner = untag_ptr(a);
54845         a_conv.is_owned = ptr_is_owned(a);
54846         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54847         a_conv.is_owned = false;
54848         LDKRoute b_conv;
54849         b_conv.inner = untag_ptr(b);
54850         b_conv.is_owned = ptr_is_owned(b);
54851         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54852         b_conv.is_owned = false;
54853         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
54854         return ret_conv;
54855 }
54856
54857 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
54858         LDKRoute this_arg_conv;
54859         this_arg_conv.inner = untag_ptr(this_arg);
54860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54862         this_arg_conv.is_owned = false;
54863         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
54864         return ret_conv;
54865 }
54866
54867 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
54868         LDKRoute this_arg_conv;
54869         this_arg_conv.inner = untag_ptr(this_arg);
54870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54872         this_arg_conv.is_owned = false;
54873         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
54874         return ret_conv;
54875 }
54876
54877 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
54878         LDKRoute obj_conv;
54879         obj_conv.inner = untag_ptr(obj);
54880         obj_conv.is_owned = ptr_is_owned(obj);
54881         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54882         obj_conv.is_owned = false;
54883         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
54884         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54885         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54886         CVec_u8Z_free(ret_var);
54887         return ret_arr;
54888 }
54889
54890 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
54891         LDKu8slice ser_ref;
54892         ser_ref.datalen = ser->arr_len;
54893         ser_ref.data = ser->elems;
54894         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
54895         *ret_conv = Route_read(ser_ref);
54896         FREE(ser);
54897         return tag_ptr(ret_conv, true);
54898 }
54899
54900 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
54901         LDKRouteParameters this_obj_conv;
54902         this_obj_conv.inner = untag_ptr(this_obj);
54903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54905         RouteParameters_free(this_obj_conv);
54906 }
54907
54908 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
54909         LDKRouteParameters this_ptr_conv;
54910         this_ptr_conv.inner = untag_ptr(this_ptr);
54911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54913         this_ptr_conv.is_owned = false;
54914         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
54915         uint64_t ret_ref = 0;
54916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54918         return ret_ref;
54919 }
54920
54921 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
54922         LDKRouteParameters this_ptr_conv;
54923         this_ptr_conv.inner = untag_ptr(this_ptr);
54924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54926         this_ptr_conv.is_owned = false;
54927         LDKPaymentParameters val_conv;
54928         val_conv.inner = untag_ptr(val);
54929         val_conv.is_owned = ptr_is_owned(val);
54930         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54931         val_conv = PaymentParameters_clone(&val_conv);
54932         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
54933 }
54934
54935 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
54936         LDKRouteParameters this_ptr_conv;
54937         this_ptr_conv.inner = untag_ptr(this_ptr);
54938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54940         this_ptr_conv.is_owned = false;
54941         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
54942         return ret_conv;
54943 }
54944
54945 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
54946         LDKRouteParameters this_ptr_conv;
54947         this_ptr_conv.inner = untag_ptr(this_ptr);
54948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54950         this_ptr_conv.is_owned = false;
54951         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
54952 }
54953
54954 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
54955         LDKPaymentParameters payment_params_arg_conv;
54956         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
54957         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
54958         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
54959         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
54960         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
54961         uint64_t ret_ref = 0;
54962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54964         return ret_ref;
54965 }
54966
54967 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
54968         LDKRouteParameters ret_var = RouteParameters_clone(arg);
54969         uint64_t ret_ref = 0;
54970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54972         return ret_ref;
54973 }
54974 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
54975         LDKRouteParameters arg_conv;
54976         arg_conv.inner = untag_ptr(arg);
54977         arg_conv.is_owned = ptr_is_owned(arg);
54978         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54979         arg_conv.is_owned = false;
54980         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
54981         return ret_conv;
54982 }
54983
54984 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
54985         LDKRouteParameters orig_conv;
54986         orig_conv.inner = untag_ptr(orig);
54987         orig_conv.is_owned = ptr_is_owned(orig);
54988         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54989         orig_conv.is_owned = false;
54990         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
54991         uint64_t ret_ref = 0;
54992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54994         return ret_ref;
54995 }
54996
54997 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
54998         LDKRouteParameters a_conv;
54999         a_conv.inner = untag_ptr(a);
55000         a_conv.is_owned = ptr_is_owned(a);
55001         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55002         a_conv.is_owned = false;
55003         LDKRouteParameters b_conv;
55004         b_conv.inner = untag_ptr(b);
55005         b_conv.is_owned = ptr_is_owned(b);
55006         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55007         b_conv.is_owned = false;
55008         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
55009         return ret_conv;
55010 }
55011
55012 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
55013         LDKRouteParameters obj_conv;
55014         obj_conv.inner = untag_ptr(obj);
55015         obj_conv.is_owned = ptr_is_owned(obj);
55016         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55017         obj_conv.is_owned = false;
55018         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
55019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55021         CVec_u8Z_free(ret_var);
55022         return ret_arr;
55023 }
55024
55025 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
55026         LDKu8slice ser_ref;
55027         ser_ref.datalen = ser->arr_len;
55028         ser_ref.data = ser->elems;
55029         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
55030         *ret_conv = RouteParameters_read(ser_ref);
55031         FREE(ser);
55032         return tag_ptr(ret_conv, true);
55033 }
55034
55035 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
55036         LDKPaymentParameters this_obj_conv;
55037         this_obj_conv.inner = untag_ptr(this_obj);
55038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55040         PaymentParameters_free(this_obj_conv);
55041 }
55042
55043 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
55044         LDKPaymentParameters this_ptr_conv;
55045         this_ptr_conv.inner = untag_ptr(this_ptr);
55046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55048         this_ptr_conv.is_owned = false;
55049         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55050         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
55051         uint64_t ret_ref = tag_ptr(ret_copy, true);
55052         return ret_ref;
55053 }
55054
55055 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
55056         LDKPaymentParameters this_ptr_conv;
55057         this_ptr_conv.inner = untag_ptr(this_ptr);
55058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55060         this_ptr_conv.is_owned = false;
55061         void* val_ptr = untag_ptr(val);
55062         CHECK_ACCESS(val_ptr);
55063         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
55064         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
55065         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
55066 }
55067
55068 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
55069         LDKPaymentParameters this_ptr_conv;
55070         this_ptr_conv.inner = untag_ptr(this_ptr);
55071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55073         this_ptr_conv.is_owned = false;
55074         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55075         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
55076         uint64_t ret_ref = tag_ptr(ret_copy, true);
55077         return ret_ref;
55078 }
55079
55080 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
55081         LDKPaymentParameters this_ptr_conv;
55082         this_ptr_conv.inner = untag_ptr(this_ptr);
55083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55085         this_ptr_conv.is_owned = false;
55086         void* val_ptr = untag_ptr(val);
55087         CHECK_ACCESS(val_ptr);
55088         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
55089         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
55090         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
55091 }
55092
55093 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) {
55094         LDKPaymentParameters this_ptr_conv;
55095         this_ptr_conv.inner = untag_ptr(this_ptr);
55096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55098         this_ptr_conv.is_owned = false;
55099         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
55100         return ret_conv;
55101 }
55102
55103 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) {
55104         LDKPaymentParameters this_ptr_conv;
55105         this_ptr_conv.inner = untag_ptr(this_ptr);
55106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55108         this_ptr_conv.is_owned = false;
55109         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
55110 }
55111
55112 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
55113         LDKPaymentParameters this_ptr_conv;
55114         this_ptr_conv.inner = untag_ptr(this_ptr);
55115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55117         this_ptr_conv.is_owned = false;
55118         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
55119         return ret_conv;
55120 }
55121
55122 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
55123         LDKPaymentParameters this_ptr_conv;
55124         this_ptr_conv.inner = untag_ptr(this_ptr);
55125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55127         this_ptr_conv.is_owned = false;
55128         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
55129 }
55130
55131 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) {
55132         LDKPaymentParameters this_ptr_conv;
55133         this_ptr_conv.inner = untag_ptr(this_ptr);
55134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55136         this_ptr_conv.is_owned = false;
55137         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
55138         return ret_conv;
55139 }
55140
55141 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) {
55142         LDKPaymentParameters this_ptr_conv;
55143         this_ptr_conv.inner = untag_ptr(this_ptr);
55144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55146         this_ptr_conv.is_owned = false;
55147         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
55148 }
55149
55150 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
55151         LDKPaymentParameters this_ptr_conv;
55152         this_ptr_conv.inner = untag_ptr(this_ptr);
55153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55155         this_ptr_conv.is_owned = false;
55156         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
55157         int64_tArray ret_arr = NULL;
55158         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
55159         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
55160         for (size_t i = 0; i < ret_var.datalen; i++) {
55161                 int64_t ret_conv_8_conv = ret_var.data[i];
55162                 ret_arr_ptr[i] = ret_conv_8_conv;
55163         }
55164         
55165         FREE(ret_var.data);
55166         return ret_arr;
55167 }
55168
55169 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
55170         LDKPaymentParameters this_ptr_conv;
55171         this_ptr_conv.inner = untag_ptr(this_ptr);
55172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55174         this_ptr_conv.is_owned = false;
55175         LDKCVec_u64Z val_constr;
55176         val_constr.datalen = val->arr_len;
55177         if (val_constr.datalen > 0)
55178                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55179         else
55180                 val_constr.data = NULL;
55181         int64_t* val_vals = val->elems;
55182         for (size_t i = 0; i < val_constr.datalen; i++) {
55183                 int64_t val_conv_8 = val_vals[i];
55184                 val_constr.data[i] = val_conv_8;
55185         }
55186         FREE(val);
55187         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
55188 }
55189
55190 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) {
55191         void* payee_arg_ptr = untag_ptr(payee_arg);
55192         CHECK_ACCESS(payee_arg_ptr);
55193         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
55194         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
55195         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
55196         CHECK_ACCESS(expiry_time_arg_ptr);
55197         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
55198         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
55199         LDKCVec_u64Z previously_failed_channels_arg_constr;
55200         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
55201         if (previously_failed_channels_arg_constr.datalen > 0)
55202                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55203         else
55204                 previously_failed_channels_arg_constr.data = NULL;
55205         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
55206         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
55207                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
55208                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
55209         }
55210         FREE(previously_failed_channels_arg);
55211         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);
55212         uint64_t ret_ref = 0;
55213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55215         return ret_ref;
55216 }
55217
55218 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
55219         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
55220         uint64_t ret_ref = 0;
55221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55223         return ret_ref;
55224 }
55225 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
55226         LDKPaymentParameters arg_conv;
55227         arg_conv.inner = untag_ptr(arg);
55228         arg_conv.is_owned = ptr_is_owned(arg);
55229         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55230         arg_conv.is_owned = false;
55231         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
55232         return ret_conv;
55233 }
55234
55235 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
55236         LDKPaymentParameters orig_conv;
55237         orig_conv.inner = untag_ptr(orig);
55238         orig_conv.is_owned = ptr_is_owned(orig);
55239         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55240         orig_conv.is_owned = false;
55241         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
55242         uint64_t ret_ref = 0;
55243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55245         return ret_ref;
55246 }
55247
55248 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
55249         LDKPaymentParameters o_conv;
55250         o_conv.inner = untag_ptr(o);
55251         o_conv.is_owned = ptr_is_owned(o);
55252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55253         o_conv.is_owned = false;
55254         int64_t ret_conv = PaymentParameters_hash(&o_conv);
55255         return ret_conv;
55256 }
55257
55258 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
55259         LDKPaymentParameters a_conv;
55260         a_conv.inner = untag_ptr(a);
55261         a_conv.is_owned = ptr_is_owned(a);
55262         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55263         a_conv.is_owned = false;
55264         LDKPaymentParameters b_conv;
55265         b_conv.inner = untag_ptr(b);
55266         b_conv.is_owned = ptr_is_owned(b);
55267         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55268         b_conv.is_owned = false;
55269         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
55270         return ret_conv;
55271 }
55272
55273 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
55274         LDKPaymentParameters obj_conv;
55275         obj_conv.inner = untag_ptr(obj);
55276         obj_conv.is_owned = ptr_is_owned(obj);
55277         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55278         obj_conv.is_owned = false;
55279         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
55280         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55281         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55282         CVec_u8Z_free(ret_var);
55283         return ret_arr;
55284 }
55285
55286 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
55287         LDKu8slice ser_ref;
55288         ser_ref.datalen = ser->arr_len;
55289         ser_ref.data = ser->elems;
55290         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
55291         *ret_conv = PaymentParameters_read(ser_ref, arg);
55292         FREE(ser);
55293         return tag_ptr(ret_conv, true);
55294 }
55295
55296 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) {
55297         LDKPublicKey payee_pubkey_ref;
55298         CHECK(payee_pubkey->arr_len == 33);
55299         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
55300         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
55301         uint64_t ret_ref = 0;
55302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55304         return ret_ref;
55305 }
55306
55307 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) {
55308         LDKPublicKey payee_pubkey_ref;
55309         CHECK(payee_pubkey->arr_len == 33);
55310         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
55311         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
55312         uint64_t ret_ref = 0;
55313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55315         return ret_ref;
55316 }
55317
55318 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
55319         LDKBolt12Invoice invoice_conv;
55320         invoice_conv.inner = untag_ptr(invoice);
55321         invoice_conv.is_owned = ptr_is_owned(invoice);
55322         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
55323         invoice_conv.is_owned = false;
55324         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
55325         uint64_t ret_ref = 0;
55326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55328         return ret_ref;
55329 }
55330
55331 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
55332         if (!ptr_is_owned(this_ptr)) return;
55333         void* this_ptr_ptr = untag_ptr(this_ptr);
55334         CHECK_ACCESS(this_ptr_ptr);
55335         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
55336         FREE(untag_ptr(this_ptr));
55337         Payee_free(this_ptr_conv);
55338 }
55339
55340 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
55341         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55342         *ret_copy = Payee_clone(arg);
55343         uint64_t ret_ref = tag_ptr(ret_copy, true);
55344         return ret_ref;
55345 }
55346 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
55347         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
55348         int64_t ret_conv = Payee_clone_ptr(arg_conv);
55349         return ret_conv;
55350 }
55351
55352 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
55353         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
55354         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55355         *ret_copy = Payee_clone(orig_conv);
55356         uint64_t ret_ref = tag_ptr(ret_copy, true);
55357         return ret_ref;
55358 }
55359
55360 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
55361         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
55362         route_hints_constr.datalen = route_hints->arr_len;
55363         if (route_hints_constr.datalen > 0)
55364                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
55365         else
55366                 route_hints_constr.data = NULL;
55367         uint64_t* route_hints_vals = route_hints->elems;
55368         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
55369                 uint64_t route_hints_conv_37 = route_hints_vals[l];
55370                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
55371                 CHECK_ACCESS(route_hints_conv_37_ptr);
55372                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
55373                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
55374                 route_hints_constr.data[l] = route_hints_conv_37_conv;
55375         }
55376         FREE(route_hints);
55377         LDKBolt12InvoiceFeatures features_conv;
55378         features_conv.inner = untag_ptr(features);
55379         features_conv.is_owned = ptr_is_owned(features);
55380         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
55381         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
55382         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55383         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
55384         uint64_t ret_ref = tag_ptr(ret_copy, true);
55385         return ret_ref;
55386 }
55387
55388 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) {
55389         LDKPublicKey node_id_ref;
55390         CHECK(node_id->arr_len == 33);
55391         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
55392         LDKCVec_RouteHintZ route_hints_constr;
55393         route_hints_constr.datalen = route_hints->arr_len;
55394         if (route_hints_constr.datalen > 0)
55395                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
55396         else
55397                 route_hints_constr.data = NULL;
55398         uint64_t* route_hints_vals = route_hints->elems;
55399         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
55400                 uint64_t route_hints_conv_11 = route_hints_vals[l];
55401                 LDKRouteHint route_hints_conv_11_conv;
55402                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
55403                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
55404                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
55405                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
55406                 route_hints_constr.data[l] = route_hints_conv_11_conv;
55407         }
55408         FREE(route_hints);
55409         LDKBolt11InvoiceFeatures features_conv;
55410         features_conv.inner = untag_ptr(features);
55411         features_conv.is_owned = ptr_is_owned(features);
55412         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
55413         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
55414         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55415         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
55416         uint64_t ret_ref = tag_ptr(ret_copy, true);
55417         return ret_ref;
55418 }
55419
55420 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
55421         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
55422         int64_t ret_conv = Payee_hash(o_conv);
55423         return ret_conv;
55424 }
55425
55426 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
55427         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
55428         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
55429         jboolean ret_conv = Payee_eq(a_conv, b_conv);
55430         return ret_conv;
55431 }
55432
55433 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
55434         LDKRouteHint this_obj_conv;
55435         this_obj_conv.inner = untag_ptr(this_obj);
55436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55438         RouteHint_free(this_obj_conv);
55439 }
55440
55441 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
55442         LDKRouteHint this_ptr_conv;
55443         this_ptr_conv.inner = untag_ptr(this_ptr);
55444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55446         this_ptr_conv.is_owned = false;
55447         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
55448         uint64_tArray ret_arr = NULL;
55449         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55450         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55451         for (size_t o = 0; o < ret_var.datalen; o++) {
55452                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
55453                 uint64_t ret_conv_14_ref = 0;
55454                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
55455                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
55456                 ret_arr_ptr[o] = ret_conv_14_ref;
55457         }
55458         
55459         FREE(ret_var.data);
55460         return ret_arr;
55461 }
55462
55463 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
55464         LDKRouteHint this_ptr_conv;
55465         this_ptr_conv.inner = untag_ptr(this_ptr);
55466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55468         this_ptr_conv.is_owned = false;
55469         LDKCVec_RouteHintHopZ val_constr;
55470         val_constr.datalen = val->arr_len;
55471         if (val_constr.datalen > 0)
55472                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
55473         else
55474                 val_constr.data = NULL;
55475         uint64_t* val_vals = val->elems;
55476         for (size_t o = 0; o < val_constr.datalen; o++) {
55477                 uint64_t val_conv_14 = val_vals[o];
55478                 LDKRouteHintHop val_conv_14_conv;
55479                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
55480                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
55481                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
55482                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
55483                 val_constr.data[o] = val_conv_14_conv;
55484         }
55485         FREE(val);
55486         RouteHint_set_a(&this_ptr_conv, val_constr);
55487 }
55488
55489 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
55490         LDKCVec_RouteHintHopZ a_arg_constr;
55491         a_arg_constr.datalen = a_arg->arr_len;
55492         if (a_arg_constr.datalen > 0)
55493                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
55494         else
55495                 a_arg_constr.data = NULL;
55496         uint64_t* a_arg_vals = a_arg->elems;
55497         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
55498                 uint64_t a_arg_conv_14 = a_arg_vals[o];
55499                 LDKRouteHintHop a_arg_conv_14_conv;
55500                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
55501                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
55502                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
55503                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
55504                 a_arg_constr.data[o] = a_arg_conv_14_conv;
55505         }
55506         FREE(a_arg);
55507         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
55508         uint64_t ret_ref = 0;
55509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55511         return ret_ref;
55512 }
55513
55514 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
55515         LDKRouteHint ret_var = RouteHint_clone(arg);
55516         uint64_t ret_ref = 0;
55517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55519         return ret_ref;
55520 }
55521 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
55522         LDKRouteHint arg_conv;
55523         arg_conv.inner = untag_ptr(arg);
55524         arg_conv.is_owned = ptr_is_owned(arg);
55525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55526         arg_conv.is_owned = false;
55527         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
55528         return ret_conv;
55529 }
55530
55531 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
55532         LDKRouteHint orig_conv;
55533         orig_conv.inner = untag_ptr(orig);
55534         orig_conv.is_owned = ptr_is_owned(orig);
55535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55536         orig_conv.is_owned = false;
55537         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
55538         uint64_t ret_ref = 0;
55539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55541         return ret_ref;
55542 }
55543
55544 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
55545         LDKRouteHint o_conv;
55546         o_conv.inner = untag_ptr(o);
55547         o_conv.is_owned = ptr_is_owned(o);
55548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55549         o_conv.is_owned = false;
55550         int64_t ret_conv = RouteHint_hash(&o_conv);
55551         return ret_conv;
55552 }
55553
55554 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
55555         LDKRouteHint a_conv;
55556         a_conv.inner = untag_ptr(a);
55557         a_conv.is_owned = ptr_is_owned(a);
55558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55559         a_conv.is_owned = false;
55560         LDKRouteHint b_conv;
55561         b_conv.inner = untag_ptr(b);
55562         b_conv.is_owned = ptr_is_owned(b);
55563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55564         b_conv.is_owned = false;
55565         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
55566         return ret_conv;
55567 }
55568
55569 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
55570         LDKRouteHint obj_conv;
55571         obj_conv.inner = untag_ptr(obj);
55572         obj_conv.is_owned = ptr_is_owned(obj);
55573         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55574         obj_conv.is_owned = false;
55575         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
55576         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55577         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55578         CVec_u8Z_free(ret_var);
55579         return ret_arr;
55580 }
55581
55582 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
55583         LDKu8slice ser_ref;
55584         ser_ref.datalen = ser->arr_len;
55585         ser_ref.data = ser->elems;
55586         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
55587         *ret_conv = RouteHint_read(ser_ref);
55588         FREE(ser);
55589         return tag_ptr(ret_conv, true);
55590 }
55591
55592 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
55593         LDKRouteHintHop this_obj_conv;
55594         this_obj_conv.inner = untag_ptr(this_obj);
55595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55597         RouteHintHop_free(this_obj_conv);
55598 }
55599
55600 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
55601         LDKRouteHintHop this_ptr_conv;
55602         this_ptr_conv.inner = untag_ptr(this_ptr);
55603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55605         this_ptr_conv.is_owned = false;
55606         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55607         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
55608         return ret_arr;
55609 }
55610
55611 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
55612         LDKRouteHintHop this_ptr_conv;
55613         this_ptr_conv.inner = untag_ptr(this_ptr);
55614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55616         this_ptr_conv.is_owned = false;
55617         LDKPublicKey val_ref;
55618         CHECK(val->arr_len == 33);
55619         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
55620         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
55621 }
55622
55623 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
55624         LDKRouteHintHop this_ptr_conv;
55625         this_ptr_conv.inner = untag_ptr(this_ptr);
55626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55628         this_ptr_conv.is_owned = false;
55629         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
55630         return ret_conv;
55631 }
55632
55633 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
55634         LDKRouteHintHop this_ptr_conv;
55635         this_ptr_conv.inner = untag_ptr(this_ptr);
55636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55638         this_ptr_conv.is_owned = false;
55639         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
55640 }
55641
55642 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
55643         LDKRouteHintHop this_ptr_conv;
55644         this_ptr_conv.inner = untag_ptr(this_ptr);
55645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55647         this_ptr_conv.is_owned = false;
55648         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
55649         uint64_t ret_ref = 0;
55650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55652         return ret_ref;
55653 }
55654
55655 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
55656         LDKRouteHintHop this_ptr_conv;
55657         this_ptr_conv.inner = untag_ptr(this_ptr);
55658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55660         this_ptr_conv.is_owned = false;
55661         LDKRoutingFees val_conv;
55662         val_conv.inner = untag_ptr(val);
55663         val_conv.is_owned = ptr_is_owned(val);
55664         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55665         val_conv = RoutingFees_clone(&val_conv);
55666         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
55667 }
55668
55669 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
55670         LDKRouteHintHop this_ptr_conv;
55671         this_ptr_conv.inner = untag_ptr(this_ptr);
55672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55674         this_ptr_conv.is_owned = false;
55675         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
55676         return ret_conv;
55677 }
55678
55679 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
55680         LDKRouteHintHop this_ptr_conv;
55681         this_ptr_conv.inner = untag_ptr(this_ptr);
55682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55684         this_ptr_conv.is_owned = false;
55685         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
55686 }
55687
55688 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
55689         LDKRouteHintHop this_ptr_conv;
55690         this_ptr_conv.inner = untag_ptr(this_ptr);
55691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55693         this_ptr_conv.is_owned = false;
55694         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55695         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
55696         uint64_t ret_ref = tag_ptr(ret_copy, true);
55697         return ret_ref;
55698 }
55699
55700 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
55701         LDKRouteHintHop this_ptr_conv;
55702         this_ptr_conv.inner = untag_ptr(this_ptr);
55703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55705         this_ptr_conv.is_owned = false;
55706         void* val_ptr = untag_ptr(val);
55707         CHECK_ACCESS(val_ptr);
55708         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
55709         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
55710         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
55711 }
55712
55713 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
55714         LDKRouteHintHop this_ptr_conv;
55715         this_ptr_conv.inner = untag_ptr(this_ptr);
55716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55718         this_ptr_conv.is_owned = false;
55719         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55720         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
55721         uint64_t ret_ref = tag_ptr(ret_copy, true);
55722         return ret_ref;
55723 }
55724
55725 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
55726         LDKRouteHintHop this_ptr_conv;
55727         this_ptr_conv.inner = untag_ptr(this_ptr);
55728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55730         this_ptr_conv.is_owned = false;
55731         void* val_ptr = untag_ptr(val);
55732         CHECK_ACCESS(val_ptr);
55733         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
55734         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
55735         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
55736 }
55737
55738 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) {
55739         LDKPublicKey src_node_id_arg_ref;
55740         CHECK(src_node_id_arg->arr_len == 33);
55741         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
55742         LDKRoutingFees fees_arg_conv;
55743         fees_arg_conv.inner = untag_ptr(fees_arg);
55744         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
55745         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
55746         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
55747         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
55748         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
55749         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
55750         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
55751         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
55752         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
55753         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
55754         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
55755         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);
55756         uint64_t ret_ref = 0;
55757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55759         return ret_ref;
55760 }
55761
55762 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
55763         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
55764         uint64_t ret_ref = 0;
55765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55767         return ret_ref;
55768 }
55769 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
55770         LDKRouteHintHop arg_conv;
55771         arg_conv.inner = untag_ptr(arg);
55772         arg_conv.is_owned = ptr_is_owned(arg);
55773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55774         arg_conv.is_owned = false;
55775         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
55776         return ret_conv;
55777 }
55778
55779 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
55780         LDKRouteHintHop orig_conv;
55781         orig_conv.inner = untag_ptr(orig);
55782         orig_conv.is_owned = ptr_is_owned(orig);
55783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55784         orig_conv.is_owned = false;
55785         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
55786         uint64_t ret_ref = 0;
55787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55789         return ret_ref;
55790 }
55791
55792 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
55793         LDKRouteHintHop o_conv;
55794         o_conv.inner = untag_ptr(o);
55795         o_conv.is_owned = ptr_is_owned(o);
55796         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55797         o_conv.is_owned = false;
55798         int64_t ret_conv = RouteHintHop_hash(&o_conv);
55799         return ret_conv;
55800 }
55801
55802 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
55803         LDKRouteHintHop a_conv;
55804         a_conv.inner = untag_ptr(a);
55805         a_conv.is_owned = ptr_is_owned(a);
55806         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55807         a_conv.is_owned = false;
55808         LDKRouteHintHop b_conv;
55809         b_conv.inner = untag_ptr(b);
55810         b_conv.is_owned = ptr_is_owned(b);
55811         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55812         b_conv.is_owned = false;
55813         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
55814         return ret_conv;
55815 }
55816
55817 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
55818         LDKRouteHintHop obj_conv;
55819         obj_conv.inner = untag_ptr(obj);
55820         obj_conv.is_owned = ptr_is_owned(obj);
55821         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55822         obj_conv.is_owned = false;
55823         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
55824         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55825         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55826         CVec_u8Z_free(ret_var);
55827         return ret_arr;
55828 }
55829
55830 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
55831         LDKu8slice ser_ref;
55832         ser_ref.datalen = ser->arr_len;
55833         ser_ref.data = ser->elems;
55834         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
55835         *ret_conv = RouteHintHop_read(ser_ref);
55836         FREE(ser);
55837         return tag_ptr(ret_conv, true);
55838 }
55839
55840 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) {
55841         LDKPublicKey our_node_pubkey_ref;
55842         CHECK(our_node_pubkey->arr_len == 33);
55843         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
55844         LDKRouteParameters route_params_conv;
55845         route_params_conv.inner = untag_ptr(route_params);
55846         route_params_conv.is_owned = ptr_is_owned(route_params);
55847         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
55848         route_params_conv.is_owned = false;
55849         LDKNetworkGraph network_graph_conv;
55850         network_graph_conv.inner = untag_ptr(network_graph);
55851         network_graph_conv.is_owned = ptr_is_owned(network_graph);
55852         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
55853         network_graph_conv.is_owned = false;
55854         LDKCVec_ChannelDetailsZ first_hops_constr;
55855         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
55856         if (first_hops != 0) {
55857                 first_hops_constr.datalen = first_hops->arr_len;
55858                 if (first_hops_constr.datalen > 0)
55859                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
55860                 else
55861                         first_hops_constr.data = NULL;
55862                 uint64_t* first_hops_vals = first_hops->elems;
55863                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
55864                         uint64_t first_hops_conv_16 = first_hops_vals[q];
55865                         LDKChannelDetails first_hops_conv_16_conv;
55866                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
55867                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
55868                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
55869                         first_hops_conv_16_conv.is_owned = false;
55870                         first_hops_constr.data[q] = first_hops_conv_16_conv;
55871                 }
55872                 FREE(first_hops);
55873                 first_hops_ptr = &first_hops_constr;
55874         }
55875         void* logger_ptr = untag_ptr(logger);
55876         CHECK_ACCESS(logger_ptr);
55877         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
55878         if (logger_conv.free == LDKLogger_JCalls_free) {
55879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55880                 LDKLogger_JCalls_cloned(&logger_conv);
55881         }
55882         void* scorer_ptr = untag_ptr(scorer);
55883         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
55884         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
55885         LDKProbabilisticScoringFeeParameters score_params_conv;
55886         score_params_conv.inner = untag_ptr(score_params);
55887         score_params_conv.is_owned = ptr_is_owned(score_params);
55888         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
55889         score_params_conv.is_owned = false;
55890         uint8_t random_seed_bytes_arr[32];
55891         CHECK(random_seed_bytes->arr_len == 32);
55892         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
55893         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
55894         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
55895         *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);
55896         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
55897         return tag_ptr(ret_conv, true);
55898 }
55899
55900 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) {
55901         LDKPublicKey our_node_pubkey_ref;
55902         CHECK(our_node_pubkey->arr_len == 33);
55903         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
55904         LDKCVec_PublicKeyZ hops_constr;
55905         hops_constr.datalen = hops->arr_len;
55906         if (hops_constr.datalen > 0)
55907                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
55908         else
55909                 hops_constr.data = NULL;
55910         int8_tArray* hops_vals = (void*) hops->elems;
55911         for (size_t m = 0; m < hops_constr.datalen; m++) {
55912                 int8_tArray hops_conv_12 = hops_vals[m];
55913                 LDKPublicKey hops_conv_12_ref;
55914                 CHECK(hops_conv_12->arr_len == 33);
55915                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
55916                 hops_constr.data[m] = hops_conv_12_ref;
55917         }
55918         FREE(hops);
55919         LDKRouteParameters route_params_conv;
55920         route_params_conv.inner = untag_ptr(route_params);
55921         route_params_conv.is_owned = ptr_is_owned(route_params);
55922         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
55923         route_params_conv.is_owned = false;
55924         LDKNetworkGraph network_graph_conv;
55925         network_graph_conv.inner = untag_ptr(network_graph);
55926         network_graph_conv.is_owned = ptr_is_owned(network_graph);
55927         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
55928         network_graph_conv.is_owned = false;
55929         void* logger_ptr = untag_ptr(logger);
55930         CHECK_ACCESS(logger_ptr);
55931         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
55932         if (logger_conv.free == LDKLogger_JCalls_free) {
55933                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55934                 LDKLogger_JCalls_cloned(&logger_conv);
55935         }
55936         uint8_t random_seed_bytes_arr[32];
55937         CHECK(random_seed_bytes->arr_len == 32);
55938         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
55939         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
55940         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
55941         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
55942         return tag_ptr(ret_conv, true);
55943 }
55944
55945 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
55946         if (!ptr_is_owned(this_ptr)) return;
55947         void* this_ptr_ptr = untag_ptr(this_ptr);
55948         CHECK_ACCESS(this_ptr_ptr);
55949         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
55950         FREE(untag_ptr(this_ptr));
55951         Score_free(this_ptr_conv);
55952 }
55953
55954 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
55955         if (!ptr_is_owned(this_ptr)) return;
55956         void* this_ptr_ptr = untag_ptr(this_ptr);
55957         CHECK_ACCESS(this_ptr_ptr);
55958         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
55959         FREE(untag_ptr(this_ptr));
55960         LockableScore_free(this_ptr_conv);
55961 }
55962
55963 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
55964         if (!ptr_is_owned(this_ptr)) return;
55965         void* this_ptr_ptr = untag_ptr(this_ptr);
55966         CHECK_ACCESS(this_ptr_ptr);
55967         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
55968         FREE(untag_ptr(this_ptr));
55969         WriteableScore_free(this_ptr_conv);
55970 }
55971
55972 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
55973         LDKMultiThreadedLockableScore this_obj_conv;
55974         this_obj_conv.inner = untag_ptr(this_obj);
55975         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55977         MultiThreadedLockableScore_free(this_obj_conv);
55978 }
55979
55980 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
55981         LDKMultiThreadedLockableScore this_arg_conv;
55982         this_arg_conv.inner = untag_ptr(this_arg);
55983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55985         this_arg_conv.is_owned = false;
55986         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
55987         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
55988         return tag_ptr(ret_ret, true);
55989 }
55990
55991 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
55992         LDKMultiThreadedLockableScore obj_conv;
55993         obj_conv.inner = untag_ptr(obj);
55994         obj_conv.is_owned = ptr_is_owned(obj);
55995         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55996         obj_conv.is_owned = false;
55997         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
55998         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55999         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56000         CVec_u8Z_free(ret_var);
56001         return ret_arr;
56002 }
56003
56004 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
56005         LDKMultiThreadedLockableScore this_arg_conv;
56006         this_arg_conv.inner = untag_ptr(this_arg);
56007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56009         this_arg_conv.is_owned = false;
56010         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
56011         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
56012         return tag_ptr(ret_ret, true);
56013 }
56014
56015 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
56016         void* score_ptr = untag_ptr(score);
56017         CHECK_ACCESS(score_ptr);
56018         LDKScore score_conv = *(LDKScore*)(score_ptr);
56019         if (score_conv.free == LDKScore_JCalls_free) {
56020                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56021                 LDKScore_JCalls_cloned(&score_conv);
56022         }
56023         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
56024         uint64_t ret_ref = 0;
56025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56027         return ret_ref;
56028 }
56029
56030 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
56031         LDKMultiThreadedScoreLock this_obj_conv;
56032         this_obj_conv.inner = untag_ptr(this_obj);
56033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56035         MultiThreadedScoreLock_free(this_obj_conv);
56036 }
56037
56038 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
56039         LDKMultiThreadedScoreLock obj_conv;
56040         obj_conv.inner = untag_ptr(obj);
56041         obj_conv.is_owned = ptr_is_owned(obj);
56042         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56043         obj_conv.is_owned = false;
56044         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
56045         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56046         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56047         CVec_u8Z_free(ret_var);
56048         return ret_arr;
56049 }
56050
56051 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
56052         LDKMultiThreadedScoreLock this_arg_conv;
56053         this_arg_conv.inner = untag_ptr(this_arg);
56054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56056         this_arg_conv.is_owned = false;
56057         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
56058         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
56059         return tag_ptr(ret_ret, true);
56060 }
56061
56062 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
56063         LDKChannelUsage this_obj_conv;
56064         this_obj_conv.inner = untag_ptr(this_obj);
56065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56067         ChannelUsage_free(this_obj_conv);
56068 }
56069
56070 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
56071         LDKChannelUsage this_ptr_conv;
56072         this_ptr_conv.inner = untag_ptr(this_ptr);
56073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56075         this_ptr_conv.is_owned = false;
56076         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
56077         return ret_conv;
56078 }
56079
56080 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
56081         LDKChannelUsage this_ptr_conv;
56082         this_ptr_conv.inner = untag_ptr(this_ptr);
56083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56085         this_ptr_conv.is_owned = false;
56086         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
56087 }
56088
56089 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
56090         LDKChannelUsage this_ptr_conv;
56091         this_ptr_conv.inner = untag_ptr(this_ptr);
56092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56094         this_ptr_conv.is_owned = false;
56095         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
56096         return ret_conv;
56097 }
56098
56099 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
56100         LDKChannelUsage this_ptr_conv;
56101         this_ptr_conv.inner = untag_ptr(this_ptr);
56102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56104         this_ptr_conv.is_owned = false;
56105         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
56106 }
56107
56108 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
56109         LDKChannelUsage this_ptr_conv;
56110         this_ptr_conv.inner = untag_ptr(this_ptr);
56111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56113         this_ptr_conv.is_owned = false;
56114         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56115         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
56116         uint64_t ret_ref = tag_ptr(ret_copy, true);
56117         return ret_ref;
56118 }
56119
56120 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
56121         LDKChannelUsage this_ptr_conv;
56122         this_ptr_conv.inner = untag_ptr(this_ptr);
56123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56125         this_ptr_conv.is_owned = false;
56126         void* val_ptr = untag_ptr(val);
56127         CHECK_ACCESS(val_ptr);
56128         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
56129         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
56130         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
56131 }
56132
56133 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) {
56134         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
56135         CHECK_ACCESS(effective_capacity_arg_ptr);
56136         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
56137         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
56138         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
56139         uint64_t ret_ref = 0;
56140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56142         return ret_ref;
56143 }
56144
56145 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
56146         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
56147         uint64_t ret_ref = 0;
56148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56150         return ret_ref;
56151 }
56152 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
56153         LDKChannelUsage arg_conv;
56154         arg_conv.inner = untag_ptr(arg);
56155         arg_conv.is_owned = ptr_is_owned(arg);
56156         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56157         arg_conv.is_owned = false;
56158         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
56159         return ret_conv;
56160 }
56161
56162 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
56163         LDKChannelUsage orig_conv;
56164         orig_conv.inner = untag_ptr(orig);
56165         orig_conv.is_owned = ptr_is_owned(orig);
56166         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56167         orig_conv.is_owned = false;
56168         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
56169         uint64_t ret_ref = 0;
56170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56172         return ret_ref;
56173 }
56174
56175 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
56176         LDKFixedPenaltyScorer this_obj_conv;
56177         this_obj_conv.inner = untag_ptr(this_obj);
56178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56180         FixedPenaltyScorer_free(this_obj_conv);
56181 }
56182
56183 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
56184         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
56185         uint64_t ret_ref = 0;
56186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56188         return ret_ref;
56189 }
56190 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
56191         LDKFixedPenaltyScorer arg_conv;
56192         arg_conv.inner = untag_ptr(arg);
56193         arg_conv.is_owned = ptr_is_owned(arg);
56194         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56195         arg_conv.is_owned = false;
56196         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
56197         return ret_conv;
56198 }
56199
56200 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
56201         LDKFixedPenaltyScorer orig_conv;
56202         orig_conv.inner = untag_ptr(orig);
56203         orig_conv.is_owned = ptr_is_owned(orig);
56204         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56205         orig_conv.is_owned = false;
56206         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
56207         uint64_t ret_ref = 0;
56208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56210         return ret_ref;
56211 }
56212
56213 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
56214         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
56215         uint64_t ret_ref = 0;
56216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56218         return ret_ref;
56219 }
56220
56221 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
56222         LDKFixedPenaltyScorer this_arg_conv;
56223         this_arg_conv.inner = untag_ptr(this_arg);
56224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56226         this_arg_conv.is_owned = false;
56227         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
56228         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
56229         return tag_ptr(ret_ret, true);
56230 }
56231
56232 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
56233         LDKFixedPenaltyScorer obj_conv;
56234         obj_conv.inner = untag_ptr(obj);
56235         obj_conv.is_owned = ptr_is_owned(obj);
56236         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56237         obj_conv.is_owned = false;
56238         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
56239         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56240         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56241         CVec_u8Z_free(ret_var);
56242         return ret_arr;
56243 }
56244
56245 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
56246         LDKu8slice ser_ref;
56247         ser_ref.datalen = ser->arr_len;
56248         ser_ref.data = ser->elems;
56249         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
56250         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
56251         FREE(ser);
56252         return tag_ptr(ret_conv, true);
56253 }
56254
56255 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
56256         LDKProbabilisticScorer this_obj_conv;
56257         this_obj_conv.inner = untag_ptr(this_obj);
56258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56260         ProbabilisticScorer_free(this_obj_conv);
56261 }
56262
56263 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
56264         LDKProbabilisticScoringFeeParameters this_obj_conv;
56265         this_obj_conv.inner = untag_ptr(this_obj);
56266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56268         ProbabilisticScoringFeeParameters_free(this_obj_conv);
56269 }
56270
56271 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
56272         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56273         this_ptr_conv.inner = untag_ptr(this_ptr);
56274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56276         this_ptr_conv.is_owned = false;
56277         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
56278         return ret_conv;
56279 }
56280
56281 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
56282         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56283         this_ptr_conv.inner = untag_ptr(this_ptr);
56284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56286         this_ptr_conv.is_owned = false;
56287         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
56288 }
56289
56290 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) {
56291         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56292         this_ptr_conv.inner = untag_ptr(this_ptr);
56293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56295         this_ptr_conv.is_owned = false;
56296         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
56297         return ret_conv;
56298 }
56299
56300 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) {
56301         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56302         this_ptr_conv.inner = untag_ptr(this_ptr);
56303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56305         this_ptr_conv.is_owned = false;
56306         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
56307 }
56308
56309 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
56310         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56311         this_ptr_conv.inner = untag_ptr(this_ptr);
56312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56314         this_ptr_conv.is_owned = false;
56315         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
56316         return ret_conv;
56317 }
56318
56319 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) {
56320         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56321         this_ptr_conv.inner = untag_ptr(this_ptr);
56322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56324         this_ptr_conv.is_owned = false;
56325         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
56326 }
56327
56328 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) {
56329         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56330         this_ptr_conv.inner = untag_ptr(this_ptr);
56331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56333         this_ptr_conv.is_owned = false;
56334         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
56335         return ret_conv;
56336 }
56337
56338 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) {
56339         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56340         this_ptr_conv.inner = untag_ptr(this_ptr);
56341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56343         this_ptr_conv.is_owned = false;
56344         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
56345 }
56346
56347 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) {
56348         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56349         this_ptr_conv.inner = untag_ptr(this_ptr);
56350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56352         this_ptr_conv.is_owned = false;
56353         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
56354         return ret_conv;
56355 }
56356
56357 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) {
56358         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56359         this_ptr_conv.inner = untag_ptr(this_ptr);
56360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56362         this_ptr_conv.is_owned = false;
56363         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
56364 }
56365
56366 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) {
56367         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56368         this_ptr_conv.inner = untag_ptr(this_ptr);
56369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56371         this_ptr_conv.is_owned = false;
56372         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
56373         return ret_conv;
56374 }
56375
56376 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) {
56377         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56378         this_ptr_conv.inner = untag_ptr(this_ptr);
56379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56381         this_ptr_conv.is_owned = false;
56382         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
56383 }
56384
56385 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
56386         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56387         this_ptr_conv.inner = untag_ptr(this_ptr);
56388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56390         this_ptr_conv.is_owned = false;
56391         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
56392         return ret_conv;
56393 }
56394
56395 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) {
56396         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56397         this_ptr_conv.inner = untag_ptr(this_ptr);
56398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56400         this_ptr_conv.is_owned = false;
56401         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
56402 }
56403
56404 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
56405         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56406         this_ptr_conv.inner = untag_ptr(this_ptr);
56407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56409         this_ptr_conv.is_owned = false;
56410         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
56411         return ret_conv;
56412 }
56413
56414 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) {
56415         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56416         this_ptr_conv.inner = untag_ptr(this_ptr);
56417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56419         this_ptr_conv.is_owned = false;
56420         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
56421 }
56422
56423 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
56424         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
56425         uint64_t ret_ref = 0;
56426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56428         return ret_ref;
56429 }
56430 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
56431         LDKProbabilisticScoringFeeParameters arg_conv;
56432         arg_conv.inner = untag_ptr(arg);
56433         arg_conv.is_owned = ptr_is_owned(arg);
56434         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56435         arg_conv.is_owned = false;
56436         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
56437         return ret_conv;
56438 }
56439
56440 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
56441         LDKProbabilisticScoringFeeParameters orig_conv;
56442         orig_conv.inner = untag_ptr(orig);
56443         orig_conv.is_owned = ptr_is_owned(orig);
56444         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56445         orig_conv.is_owned = false;
56446         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
56447         uint64_t ret_ref = 0;
56448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56450         return ret_ref;
56451 }
56452
56453 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
56454         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
56455         uint64_t ret_ref = 0;
56456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56458         return ret_ref;
56459 }
56460
56461 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
56462         LDKProbabilisticScoringFeeParameters 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         LDKNodeId node_id_conv;
56468         node_id_conv.inner = untag_ptr(node_id);
56469         node_id_conv.is_owned = ptr_is_owned(node_id);
56470         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
56471         node_id_conv.is_owned = false;
56472         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
56473 }
56474
56475 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
56476         LDKProbabilisticScoringFeeParameters this_arg_conv;
56477         this_arg_conv.inner = untag_ptr(this_arg);
56478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56480         this_arg_conv.is_owned = false;
56481         LDKCVec_NodeIdZ node_ids_constr;
56482         node_ids_constr.datalen = node_ids->arr_len;
56483         if (node_ids_constr.datalen > 0)
56484                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
56485         else
56486                 node_ids_constr.data = NULL;
56487         uint64_t* node_ids_vals = node_ids->elems;
56488         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
56489                 uint64_t node_ids_conv_8 = node_ids_vals[i];
56490                 LDKNodeId node_ids_conv_8_conv;
56491                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
56492                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
56493                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
56494                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
56495                 node_ids_constr.data[i] = node_ids_conv_8_conv;
56496         }
56497         FREE(node_ids);
56498         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
56499 }
56500
56501 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
56502         LDKProbabilisticScoringFeeParameters this_arg_conv;
56503         this_arg_conv.inner = untag_ptr(this_arg);
56504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56506         this_arg_conv.is_owned = false;
56507         LDKNodeId node_id_conv;
56508         node_id_conv.inner = untag_ptr(node_id);
56509         node_id_conv.is_owned = ptr_is_owned(node_id);
56510         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
56511         node_id_conv.is_owned = false;
56512         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
56513 }
56514
56515 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) {
56516         LDKProbabilisticScoringFeeParameters this_arg_conv;
56517         this_arg_conv.inner = untag_ptr(this_arg);
56518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56520         this_arg_conv.is_owned = false;
56521         LDKNodeId node_id_conv;
56522         node_id_conv.inner = untag_ptr(node_id);
56523         node_id_conv.is_owned = ptr_is_owned(node_id);
56524         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
56525         node_id_conv.is_owned = false;
56526         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
56527 }
56528
56529 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
56530         LDKProbabilisticScoringFeeParameters this_arg_conv;
56531         this_arg_conv.inner = untag_ptr(this_arg);
56532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56534         this_arg_conv.is_owned = false;
56535         LDKNodeId node_id_conv;
56536         node_id_conv.inner = untag_ptr(node_id);
56537         node_id_conv.is_owned = ptr_is_owned(node_id);
56538         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
56539         node_id_conv.is_owned = false;
56540         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
56541 }
56542
56543 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
56544         LDKProbabilisticScoringFeeParameters this_arg_conv;
56545         this_arg_conv.inner = untag_ptr(this_arg);
56546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56548         this_arg_conv.is_owned = false;
56549         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
56550 }
56551
56552 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
56553         LDKProbabilisticScoringDecayParameters this_obj_conv;
56554         this_obj_conv.inner = untag_ptr(this_obj);
56555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56557         ProbabilisticScoringDecayParameters_free(this_obj_conv);
56558 }
56559
56560 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) {
56561         LDKProbabilisticScoringDecayParameters this_ptr_conv;
56562         this_ptr_conv.inner = untag_ptr(this_ptr);
56563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56565         this_ptr_conv.is_owned = false;
56566         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
56567         return ret_conv;
56568 }
56569
56570 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) {
56571         LDKProbabilisticScoringDecayParameters this_ptr_conv;
56572         this_ptr_conv.inner = untag_ptr(this_ptr);
56573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56575         this_ptr_conv.is_owned = false;
56576         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
56577 }
56578
56579 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
56580         LDKProbabilisticScoringDecayParameters this_ptr_conv;
56581         this_ptr_conv.inner = untag_ptr(this_ptr);
56582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56584         this_ptr_conv.is_owned = false;
56585         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
56586         return ret_conv;
56587 }
56588
56589 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) {
56590         LDKProbabilisticScoringDecayParameters this_ptr_conv;
56591         this_ptr_conv.inner = untag_ptr(this_ptr);
56592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56594         this_ptr_conv.is_owned = false;
56595         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
56596 }
56597
56598 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) {
56599         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
56600         uint64_t ret_ref = 0;
56601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56603         return ret_ref;
56604 }
56605
56606 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
56607         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
56608         uint64_t ret_ref = 0;
56609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56611         return ret_ref;
56612 }
56613 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
56614         LDKProbabilisticScoringDecayParameters arg_conv;
56615         arg_conv.inner = untag_ptr(arg);
56616         arg_conv.is_owned = ptr_is_owned(arg);
56617         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56618         arg_conv.is_owned = false;
56619         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
56620         return ret_conv;
56621 }
56622
56623 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
56624         LDKProbabilisticScoringDecayParameters orig_conv;
56625         orig_conv.inner = untag_ptr(orig);
56626         orig_conv.is_owned = ptr_is_owned(orig);
56627         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56628         orig_conv.is_owned = false;
56629         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
56630         uint64_t ret_ref = 0;
56631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56633         return ret_ref;
56634 }
56635
56636 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
56637         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
56638         uint64_t ret_ref = 0;
56639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56641         return ret_ref;
56642 }
56643
56644 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
56645         LDKProbabilisticScoringDecayParameters decay_params_conv;
56646         decay_params_conv.inner = untag_ptr(decay_params);
56647         decay_params_conv.is_owned = ptr_is_owned(decay_params);
56648         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
56649         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
56650         LDKNetworkGraph network_graph_conv;
56651         network_graph_conv.inner = untag_ptr(network_graph);
56652         network_graph_conv.is_owned = ptr_is_owned(network_graph);
56653         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
56654         network_graph_conv.is_owned = false;
56655         void* logger_ptr = untag_ptr(logger);
56656         CHECK_ACCESS(logger_ptr);
56657         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
56658         if (logger_conv.free == LDKLogger_JCalls_free) {
56659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56660                 LDKLogger_JCalls_cloned(&logger_conv);
56661         }
56662         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
56663         uint64_t ret_ref = 0;
56664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56666         return ret_ref;
56667 }
56668
56669 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
56670         LDKProbabilisticScorer 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         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
56676 }
56677
56678 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) {
56679         LDKProbabilisticScorer 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         LDKNodeId target_conv;
56685         target_conv.inner = untag_ptr(target);
56686         target_conv.is_owned = ptr_is_owned(target);
56687         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
56688         target_conv.is_owned = false;
56689         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
56690         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
56691         uint64_t ret_ref = tag_ptr(ret_copy, true);
56692         return ret_ref;
56693 }
56694
56695 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) {
56696         LDKProbabilisticScorer this_arg_conv;
56697         this_arg_conv.inner = untag_ptr(this_arg);
56698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56700         this_arg_conv.is_owned = false;
56701         LDKNodeId target_conv;
56702         target_conv.inner = untag_ptr(target);
56703         target_conv.is_owned = ptr_is_owned(target);
56704         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
56705         target_conv.is_owned = false;
56706         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
56707         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
56708         uint64_t ret_ref = tag_ptr(ret_copy, true);
56709         return ret_ref;
56710 }
56711
56712 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
56713         LDKProbabilisticScorer this_arg_conv;
56714         this_arg_conv.inner = untag_ptr(this_arg);
56715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56717         this_arg_conv.is_owned = false;
56718         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
56719         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
56720         return tag_ptr(ret_ret, true);
56721 }
56722
56723 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
56724         LDKProbabilisticScorer obj_conv;
56725         obj_conv.inner = untag_ptr(obj);
56726         obj_conv.is_owned = ptr_is_owned(obj);
56727         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56728         obj_conv.is_owned = false;
56729         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
56730         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56731         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56732         CVec_u8Z_free(ret_var);
56733         return ret_arr;
56734 }
56735
56736 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) {
56737         LDKu8slice ser_ref;
56738         ser_ref.datalen = ser->arr_len;
56739         ser_ref.data = ser->elems;
56740         LDKProbabilisticScoringDecayParameters arg_a_conv;
56741         arg_a_conv.inner = untag_ptr(arg_a);
56742         arg_a_conv.is_owned = ptr_is_owned(arg_a);
56743         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
56744         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
56745         LDKNetworkGraph arg_b_conv;
56746         arg_b_conv.inner = untag_ptr(arg_b);
56747         arg_b_conv.is_owned = ptr_is_owned(arg_b);
56748         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
56749         arg_b_conv.is_owned = false;
56750         void* arg_c_ptr = untag_ptr(arg_c);
56751         CHECK_ACCESS(arg_c_ptr);
56752         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
56753         if (arg_c_conv.free == LDKLogger_JCalls_free) {
56754                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56755                 LDKLogger_JCalls_cloned(&arg_c_conv);
56756         }
56757         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
56758         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
56759         FREE(ser);
56760         return tag_ptr(ret_conv, true);
56761 }
56762
56763 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
56764         LDKDelayedPaymentOutputDescriptor this_obj_conv;
56765         this_obj_conv.inner = untag_ptr(this_obj);
56766         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56768         DelayedPaymentOutputDescriptor_free(this_obj_conv);
56769 }
56770
56771 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
56772         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56773         this_ptr_conv.inner = untag_ptr(this_ptr);
56774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56776         this_ptr_conv.is_owned = false;
56777         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
56778         uint64_t ret_ref = 0;
56779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56781         return ret_ref;
56782 }
56783
56784 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
56785         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56786         this_ptr_conv.inner = untag_ptr(this_ptr);
56787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56789         this_ptr_conv.is_owned = false;
56790         LDKOutPoint val_conv;
56791         val_conv.inner = untag_ptr(val);
56792         val_conv.is_owned = ptr_is_owned(val);
56793         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56794         val_conv = OutPoint_clone(&val_conv);
56795         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
56796 }
56797
56798 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
56799         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56800         this_ptr_conv.inner = untag_ptr(this_ptr);
56801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56803         this_ptr_conv.is_owned = false;
56804         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56805         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
56806         return ret_arr;
56807 }
56808
56809 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
56810         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56811         this_ptr_conv.inner = untag_ptr(this_ptr);
56812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56814         this_ptr_conv.is_owned = false;
56815         LDKPublicKey val_ref;
56816         CHECK(val->arr_len == 33);
56817         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56818         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
56819 }
56820
56821 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
56822         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56823         this_ptr_conv.inner = untag_ptr(this_ptr);
56824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56826         this_ptr_conv.is_owned = false;
56827         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
56828         return ret_conv;
56829 }
56830
56831 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
56832         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56833         this_ptr_conv.inner = untag_ptr(this_ptr);
56834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56836         this_ptr_conv.is_owned = false;
56837         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
56838 }
56839
56840 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
56841         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56842         this_ptr_conv.inner = untag_ptr(this_ptr);
56843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56845         this_ptr_conv.is_owned = false;
56846         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
56847         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
56848         return tag_ptr(ret_ref, true);
56849 }
56850
56851 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
56852         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56853         this_ptr_conv.inner = untag_ptr(this_ptr);
56854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56856         this_ptr_conv.is_owned = false;
56857         void* val_ptr = untag_ptr(val);
56858         CHECK_ACCESS(val_ptr);
56859         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
56860         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
56861         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
56862 }
56863
56864 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
56865         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56866         this_ptr_conv.inner = untag_ptr(this_ptr);
56867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56869         this_ptr_conv.is_owned = false;
56870         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56871         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
56872         return ret_arr;
56873 }
56874
56875 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
56876         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56877         this_ptr_conv.inner = untag_ptr(this_ptr);
56878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56880         this_ptr_conv.is_owned = false;
56881         LDKPublicKey val_ref;
56882         CHECK(val->arr_len == 33);
56883         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56884         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
56885 }
56886
56887 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
56888         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56889         this_ptr_conv.inner = untag_ptr(this_ptr);
56890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56892         this_ptr_conv.is_owned = false;
56893         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56894         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
56895         return ret_arr;
56896 }
56897
56898 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
56899         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56900         this_ptr_conv.inner = untag_ptr(this_ptr);
56901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56903         this_ptr_conv.is_owned = false;
56904         LDKThirtyTwoBytes val_ref;
56905         CHECK(val->arr_len == 32);
56906         memcpy(val_ref.data, val->elems, 32); FREE(val);
56907         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
56908 }
56909
56910 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
56911         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56912         this_ptr_conv.inner = untag_ptr(this_ptr);
56913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56915         this_ptr_conv.is_owned = false;
56916         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
56917         return ret_conv;
56918 }
56919
56920 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
56921         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56922         this_ptr_conv.inner = untag_ptr(this_ptr);
56923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56925         this_ptr_conv.is_owned = false;
56926         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
56927 }
56928
56929 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_new"))) TS_DelayedPaymentOutputDescriptor_new(uint64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, uint64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
56930         LDKOutPoint outpoint_arg_conv;
56931         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
56932         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
56933         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
56934         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
56935         LDKPublicKey per_commitment_point_arg_ref;
56936         CHECK(per_commitment_point_arg->arr_len == 33);
56937         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
56938         void* output_arg_ptr = untag_ptr(output_arg);
56939         CHECK_ACCESS(output_arg_ptr);
56940         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
56941         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
56942         LDKPublicKey revocation_pubkey_arg_ref;
56943         CHECK(revocation_pubkey_arg->arr_len == 33);
56944         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
56945         LDKThirtyTwoBytes channel_keys_id_arg_ref;
56946         CHECK(channel_keys_id_arg->arr_len == 32);
56947         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
56948         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
56949         uint64_t ret_ref = 0;
56950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56952         return ret_ref;
56953 }
56954
56955 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
56956         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
56957         uint64_t ret_ref = 0;
56958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56960         return ret_ref;
56961 }
56962 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
56963         LDKDelayedPaymentOutputDescriptor arg_conv;
56964         arg_conv.inner = untag_ptr(arg);
56965         arg_conv.is_owned = ptr_is_owned(arg);
56966         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56967         arg_conv.is_owned = false;
56968         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
56969         return ret_conv;
56970 }
56971
56972 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
56973         LDKDelayedPaymentOutputDescriptor orig_conv;
56974         orig_conv.inner = untag_ptr(orig);
56975         orig_conv.is_owned = ptr_is_owned(orig);
56976         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56977         orig_conv.is_owned = false;
56978         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
56979         uint64_t ret_ref = 0;
56980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56982         return ret_ref;
56983 }
56984
56985 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
56986         LDKDelayedPaymentOutputDescriptor a_conv;
56987         a_conv.inner = untag_ptr(a);
56988         a_conv.is_owned = ptr_is_owned(a);
56989         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56990         a_conv.is_owned = false;
56991         LDKDelayedPaymentOutputDescriptor b_conv;
56992         b_conv.inner = untag_ptr(b);
56993         b_conv.is_owned = ptr_is_owned(b);
56994         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56995         b_conv.is_owned = false;
56996         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
56997         return ret_conv;
56998 }
56999
57000 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
57001         LDKDelayedPaymentOutputDescriptor obj_conv;
57002         obj_conv.inner = untag_ptr(obj);
57003         obj_conv.is_owned = ptr_is_owned(obj);
57004         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57005         obj_conv.is_owned = false;
57006         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
57007         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57008         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57009         CVec_u8Z_free(ret_var);
57010         return ret_arr;
57011 }
57012
57013 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
57014         LDKu8slice ser_ref;
57015         ser_ref.datalen = ser->arr_len;
57016         ser_ref.data = ser->elems;
57017         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
57018         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
57019         FREE(ser);
57020         return tag_ptr(ret_conv, true);
57021 }
57022
57023 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
57024         LDKStaticPaymentOutputDescriptor this_obj_conv;
57025         this_obj_conv.inner = untag_ptr(this_obj);
57026         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57028         StaticPaymentOutputDescriptor_free(this_obj_conv);
57029 }
57030
57031 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
57032         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57033         this_ptr_conv.inner = untag_ptr(this_ptr);
57034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57036         this_ptr_conv.is_owned = false;
57037         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
57038         uint64_t ret_ref = 0;
57039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57041         return ret_ref;
57042 }
57043
57044 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
57045         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57046         this_ptr_conv.inner = untag_ptr(this_ptr);
57047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57049         this_ptr_conv.is_owned = false;
57050         LDKOutPoint val_conv;
57051         val_conv.inner = untag_ptr(val);
57052         val_conv.is_owned = ptr_is_owned(val);
57053         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57054         val_conv = OutPoint_clone(&val_conv);
57055         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
57056 }
57057
57058 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
57059         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57060         this_ptr_conv.inner = untag_ptr(this_ptr);
57061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57063         this_ptr_conv.is_owned = false;
57064         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
57065         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
57066         return tag_ptr(ret_ref, true);
57067 }
57068
57069 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
57070         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57071         this_ptr_conv.inner = untag_ptr(this_ptr);
57072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57074         this_ptr_conv.is_owned = false;
57075         void* val_ptr = untag_ptr(val);
57076         CHECK_ACCESS(val_ptr);
57077         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
57078         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
57079         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
57080 }
57081
57082 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
57083         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57084         this_ptr_conv.inner = untag_ptr(this_ptr);
57085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57087         this_ptr_conv.is_owned = false;
57088         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57089         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
57090         return ret_arr;
57091 }
57092
57093 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
57094         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57095         this_ptr_conv.inner = untag_ptr(this_ptr);
57096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57098         this_ptr_conv.is_owned = false;
57099         LDKThirtyTwoBytes val_ref;
57100         CHECK(val->arr_len == 32);
57101         memcpy(val_ref.data, val->elems, 32); FREE(val);
57102         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
57103 }
57104
57105 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
57106         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57107         this_ptr_conv.inner = untag_ptr(this_ptr);
57108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57110         this_ptr_conv.is_owned = false;
57111         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
57112         return ret_conv;
57113 }
57114
57115 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
57116         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57117         this_ptr_conv.inner = untag_ptr(this_ptr);
57118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57120         this_ptr_conv.is_owned = false;
57121         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
57122 }
57123
57124 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) {
57125         LDKOutPoint outpoint_arg_conv;
57126         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
57127         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
57128         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
57129         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
57130         void* output_arg_ptr = untag_ptr(output_arg);
57131         CHECK_ACCESS(output_arg_ptr);
57132         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
57133         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
57134         LDKThirtyTwoBytes channel_keys_id_arg_ref;
57135         CHECK(channel_keys_id_arg->arr_len == 32);
57136         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
57137         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
57138         uint64_t ret_ref = 0;
57139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57141         return ret_ref;
57142 }
57143
57144 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
57145         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
57146         uint64_t ret_ref = 0;
57147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57149         return ret_ref;
57150 }
57151 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
57152         LDKStaticPaymentOutputDescriptor arg_conv;
57153         arg_conv.inner = untag_ptr(arg);
57154         arg_conv.is_owned = ptr_is_owned(arg);
57155         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57156         arg_conv.is_owned = false;
57157         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
57158         return ret_conv;
57159 }
57160
57161 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
57162         LDKStaticPaymentOutputDescriptor orig_conv;
57163         orig_conv.inner = untag_ptr(orig);
57164         orig_conv.is_owned = ptr_is_owned(orig);
57165         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57166         orig_conv.is_owned = false;
57167         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
57168         uint64_t ret_ref = 0;
57169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57171         return ret_ref;
57172 }
57173
57174 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
57175         LDKStaticPaymentOutputDescriptor a_conv;
57176         a_conv.inner = untag_ptr(a);
57177         a_conv.is_owned = ptr_is_owned(a);
57178         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57179         a_conv.is_owned = false;
57180         LDKStaticPaymentOutputDescriptor b_conv;
57181         b_conv.inner = untag_ptr(b);
57182         b_conv.is_owned = ptr_is_owned(b);
57183         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57184         b_conv.is_owned = false;
57185         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
57186         return ret_conv;
57187 }
57188
57189 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
57190         LDKStaticPaymentOutputDescriptor obj_conv;
57191         obj_conv.inner = untag_ptr(obj);
57192         obj_conv.is_owned = ptr_is_owned(obj);
57193         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57194         obj_conv.is_owned = false;
57195         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
57196         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57197         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57198         CVec_u8Z_free(ret_var);
57199         return ret_arr;
57200 }
57201
57202 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
57203         LDKu8slice ser_ref;
57204         ser_ref.datalen = ser->arr_len;
57205         ser_ref.data = ser->elems;
57206         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
57207         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
57208         FREE(ser);
57209         return tag_ptr(ret_conv, true);
57210 }
57211
57212 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
57213         if (!ptr_is_owned(this_ptr)) return;
57214         void* this_ptr_ptr = untag_ptr(this_ptr);
57215         CHECK_ACCESS(this_ptr_ptr);
57216         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
57217         FREE(untag_ptr(this_ptr));
57218         SpendableOutputDescriptor_free(this_ptr_conv);
57219 }
57220
57221 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
57222         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57223         *ret_copy = SpendableOutputDescriptor_clone(arg);
57224         uint64_t ret_ref = tag_ptr(ret_copy, true);
57225         return ret_ref;
57226 }
57227 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
57228         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
57229         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
57230         return ret_conv;
57231 }
57232
57233 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
57234         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
57235         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57236         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
57237         uint64_t ret_ref = tag_ptr(ret_copy, true);
57238         return ret_ref;
57239 }
57240
57241 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
57242         LDKOutPoint outpoint_conv;
57243         outpoint_conv.inner = untag_ptr(outpoint);
57244         outpoint_conv.is_owned = ptr_is_owned(outpoint);
57245         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
57246         outpoint_conv = OutPoint_clone(&outpoint_conv);
57247         void* output_ptr = untag_ptr(output);
57248         CHECK_ACCESS(output_ptr);
57249         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
57250         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
57251         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57252         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
57253         uint64_t ret_ref = tag_ptr(ret_copy, true);
57254         return ret_ref;
57255 }
57256
57257 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
57258         LDKDelayedPaymentOutputDescriptor a_conv;
57259         a_conv.inner = untag_ptr(a);
57260         a_conv.is_owned = ptr_is_owned(a);
57261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57262         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
57263         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57264         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
57265         uint64_t ret_ref = tag_ptr(ret_copy, true);
57266         return ret_ref;
57267 }
57268
57269 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
57270         LDKStaticPaymentOutputDescriptor a_conv;
57271         a_conv.inner = untag_ptr(a);
57272         a_conv.is_owned = ptr_is_owned(a);
57273         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57274         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
57275         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57276         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
57277         uint64_t ret_ref = tag_ptr(ret_copy, true);
57278         return ret_ref;
57279 }
57280
57281 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
57282         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
57283         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
57284         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
57285         return ret_conv;
57286 }
57287
57288 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
57289         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
57290         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
57291         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57292         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57293         CVec_u8Z_free(ret_var);
57294         return ret_arr;
57295 }
57296
57297 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
57298         LDKu8slice ser_ref;
57299         ser_ref.datalen = ser->arr_len;
57300         ser_ref.data = ser->elems;
57301         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
57302         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
57303         FREE(ser);
57304         return tag_ptr(ret_conv, true);
57305 }
57306
57307 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) {
57308         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
57309         descriptors_constr.datalen = descriptors->arr_len;
57310         if (descriptors_constr.datalen > 0)
57311                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
57312         else
57313                 descriptors_constr.data = NULL;
57314         uint64_t* descriptors_vals = descriptors->elems;
57315         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
57316                 uint64_t descriptors_conv_27 = descriptors_vals[b];
57317                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
57318                 CHECK_ACCESS(descriptors_conv_27_ptr);
57319                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
57320                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
57321                 descriptors_constr.data[b] = descriptors_conv_27_conv;
57322         }
57323         FREE(descriptors);
57324         LDKCVec_TxOutZ outputs_constr;
57325         outputs_constr.datalen = outputs->arr_len;
57326         if (outputs_constr.datalen > 0)
57327                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
57328         else
57329                 outputs_constr.data = NULL;
57330         uint64_t* outputs_vals = outputs->elems;
57331         for (size_t h = 0; h < outputs_constr.datalen; h++) {
57332                 uint64_t outputs_conv_7 = outputs_vals[h];
57333                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
57334                 CHECK_ACCESS(outputs_conv_7_ptr);
57335                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
57336                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
57337                 outputs_constr.data[h] = outputs_conv_7_conv;
57338         }
57339         FREE(outputs);
57340         LDKCVec_u8Z change_destination_script_ref;
57341         change_destination_script_ref.datalen = change_destination_script->arr_len;
57342         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
57343         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
57344         void* locktime_ptr = untag_ptr(locktime);
57345         CHECK_ACCESS(locktime_ptr);
57346         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
57347         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
57348         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
57349         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
57350         return tag_ptr(ret_conv, true);
57351 }
57352
57353 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
57354         if (!ptr_is_owned(this_ptr)) return;
57355         void* this_ptr_ptr = untag_ptr(this_ptr);
57356         CHECK_ACCESS(this_ptr_ptr);
57357         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
57358         FREE(untag_ptr(this_ptr));
57359         ChannelSigner_free(this_ptr_conv);
57360 }
57361
57362 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
57363         if (!ptr_is_owned(this_ptr)) return;
57364         void* this_ptr_ptr = untag_ptr(this_ptr);
57365         CHECK_ACCESS(this_ptr_ptr);
57366         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
57367         FREE(untag_ptr(this_ptr));
57368         EcdsaChannelSigner_free(this_ptr_conv);
57369 }
57370
57371 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
57372         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
57373         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
57374         return tag_ptr(ret_ret, true);
57375 }
57376 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
57377         void* arg_ptr = untag_ptr(arg);
57378         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
57379         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
57380         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
57381         return ret_conv;
57382 }
57383
57384 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
57385         void* orig_ptr = untag_ptr(orig);
57386         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
57387         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
57388         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
57389         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
57390         return tag_ptr(ret_ret, true);
57391 }
57392
57393 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
57394         if (!ptr_is_owned(this_ptr)) return;
57395         void* this_ptr_ptr = untag_ptr(this_ptr);
57396         CHECK_ACCESS(this_ptr_ptr);
57397         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
57398         FREE(untag_ptr(this_ptr));
57399         WriteableEcdsaChannelSigner_free(this_ptr_conv);
57400 }
57401
57402 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
57403         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
57404         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
57405         return ret_conv;
57406 }
57407
57408 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
57409         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
57410         return ret_conv;
57411 }
57412
57413 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
57414         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
57415         return ret_conv;
57416 }
57417
57418 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
57419         if (!ptr_is_owned(this_ptr)) return;
57420         void* this_ptr_ptr = untag_ptr(this_ptr);
57421         CHECK_ACCESS(this_ptr_ptr);
57422         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
57423         FREE(untag_ptr(this_ptr));
57424         EntropySource_free(this_ptr_conv);
57425 }
57426
57427 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
57428         if (!ptr_is_owned(this_ptr)) return;
57429         void* this_ptr_ptr = untag_ptr(this_ptr);
57430         CHECK_ACCESS(this_ptr_ptr);
57431         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
57432         FREE(untag_ptr(this_ptr));
57433         NodeSigner_free(this_ptr_conv);
57434 }
57435
57436 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
57437         if (!ptr_is_owned(this_ptr)) return;
57438         void* this_ptr_ptr = untag_ptr(this_ptr);
57439         CHECK_ACCESS(this_ptr_ptr);
57440         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
57441         FREE(untag_ptr(this_ptr));
57442         SignerProvider_free(this_ptr_conv);
57443 }
57444
57445 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
57446         LDKInMemorySigner this_obj_conv;
57447         this_obj_conv.inner = untag_ptr(this_obj);
57448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57450         InMemorySigner_free(this_obj_conv);
57451 }
57452
57453 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
57454         LDKInMemorySigner this_ptr_conv;
57455         this_ptr_conv.inner = untag_ptr(this_ptr);
57456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57458         this_ptr_conv.is_owned = false;
57459         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57460         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
57461         return ret_arr;
57462 }
57463
57464 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
57465         LDKInMemorySigner this_ptr_conv;
57466         this_ptr_conv.inner = untag_ptr(this_ptr);
57467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57469         this_ptr_conv.is_owned = false;
57470         LDKSecretKey val_ref;
57471         CHECK(val->arr_len == 32);
57472         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57473         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
57474 }
57475
57476 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
57477         LDKInMemorySigner this_ptr_conv;
57478         this_ptr_conv.inner = untag_ptr(this_ptr);
57479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57481         this_ptr_conv.is_owned = false;
57482         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57483         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
57484         return ret_arr;
57485 }
57486
57487 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
57488         LDKInMemorySigner this_ptr_conv;
57489         this_ptr_conv.inner = untag_ptr(this_ptr);
57490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57492         this_ptr_conv.is_owned = false;
57493         LDKSecretKey val_ref;
57494         CHECK(val->arr_len == 32);
57495         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57496         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
57497 }
57498
57499 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
57500         LDKInMemorySigner this_ptr_conv;
57501         this_ptr_conv.inner = untag_ptr(this_ptr);
57502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57504         this_ptr_conv.is_owned = false;
57505         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57506         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
57507         return ret_arr;
57508 }
57509
57510 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
57511         LDKInMemorySigner this_ptr_conv;
57512         this_ptr_conv.inner = untag_ptr(this_ptr);
57513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57515         this_ptr_conv.is_owned = false;
57516         LDKSecretKey val_ref;
57517         CHECK(val->arr_len == 32);
57518         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57519         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
57520 }
57521
57522 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
57523         LDKInMemorySigner this_ptr_conv;
57524         this_ptr_conv.inner = untag_ptr(this_ptr);
57525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57527         this_ptr_conv.is_owned = false;
57528         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57529         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
57530         return ret_arr;
57531 }
57532
57533 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) {
57534         LDKInMemorySigner this_ptr_conv;
57535         this_ptr_conv.inner = untag_ptr(this_ptr);
57536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57538         this_ptr_conv.is_owned = false;
57539         LDKSecretKey val_ref;
57540         CHECK(val->arr_len == 32);
57541         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57542         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
57543 }
57544
57545 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
57546         LDKInMemorySigner this_ptr_conv;
57547         this_ptr_conv.inner = untag_ptr(this_ptr);
57548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57550         this_ptr_conv.is_owned = false;
57551         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57552         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
57553         return ret_arr;
57554 }
57555
57556 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
57557         LDKInMemorySigner this_ptr_conv;
57558         this_ptr_conv.inner = untag_ptr(this_ptr);
57559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57561         this_ptr_conv.is_owned = false;
57562         LDKSecretKey val_ref;
57563         CHECK(val->arr_len == 32);
57564         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57565         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
57566 }
57567
57568 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
57569         LDKInMemorySigner this_ptr_conv;
57570         this_ptr_conv.inner = untag_ptr(this_ptr);
57571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57573         this_ptr_conv.is_owned = false;
57574         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57575         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
57576         return ret_arr;
57577 }
57578
57579 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
57580         LDKInMemorySigner this_ptr_conv;
57581         this_ptr_conv.inner = untag_ptr(this_ptr);
57582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57584         this_ptr_conv.is_owned = false;
57585         LDKThirtyTwoBytes val_ref;
57586         CHECK(val->arr_len == 32);
57587         memcpy(val_ref.data, val->elems, 32); FREE(val);
57588         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
57589 }
57590
57591 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
57592         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
57593         uint64_t ret_ref = 0;
57594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57596         return ret_ref;
57597 }
57598 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
57599         LDKInMemorySigner arg_conv;
57600         arg_conv.inner = untag_ptr(arg);
57601         arg_conv.is_owned = ptr_is_owned(arg);
57602         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57603         arg_conv.is_owned = false;
57604         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
57605         return ret_conv;
57606 }
57607
57608 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
57609         LDKInMemorySigner orig_conv;
57610         orig_conv.inner = untag_ptr(orig);
57611         orig_conv.is_owned = ptr_is_owned(orig);
57612         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57613         orig_conv.is_owned = false;
57614         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
57615         uint64_t ret_ref = 0;
57616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57618         return ret_ref;
57619 }
57620
57621 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) {
57622         LDKSecretKey funding_key_ref;
57623         CHECK(funding_key->arr_len == 32);
57624         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
57625         LDKSecretKey revocation_base_key_ref;
57626         CHECK(revocation_base_key->arr_len == 32);
57627         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
57628         LDKSecretKey payment_key_ref;
57629         CHECK(payment_key->arr_len == 32);
57630         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
57631         LDKSecretKey delayed_payment_base_key_ref;
57632         CHECK(delayed_payment_base_key->arr_len == 32);
57633         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
57634         LDKSecretKey htlc_base_key_ref;
57635         CHECK(htlc_base_key->arr_len == 32);
57636         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
57637         LDKThirtyTwoBytes commitment_seed_ref;
57638         CHECK(commitment_seed->arr_len == 32);
57639         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
57640         LDKThirtyTwoBytes channel_keys_id_ref;
57641         CHECK(channel_keys_id->arr_len == 32);
57642         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
57643         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
57644         CHECK(rand_bytes_unique_start->arr_len == 32);
57645         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
57646         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);
57647         uint64_t ret_ref = 0;
57648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57650         return ret_ref;
57651 }
57652
57653 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
57654         LDKInMemorySigner this_arg_conv;
57655         this_arg_conv.inner = untag_ptr(this_arg);
57656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57658         this_arg_conv.is_owned = false;
57659         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
57660         uint64_t ret_ref = 0;
57661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57663         return ret_ref;
57664 }
57665
57666 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
57667         LDKInMemorySigner this_arg_conv;
57668         this_arg_conv.inner = untag_ptr(this_arg);
57669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57671         this_arg_conv.is_owned = false;
57672         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
57673         return ret_conv;
57674 }
57675
57676 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
57677         LDKInMemorySigner this_arg_conv;
57678         this_arg_conv.inner = untag_ptr(this_arg);
57679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57681         this_arg_conv.is_owned = false;
57682         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
57683         return ret_conv;
57684 }
57685
57686 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
57687         LDKInMemorySigner 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 = InMemorySigner_is_outbound(&this_arg_conv);
57693         return ret_conv;
57694 }
57695
57696 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
57697         LDKInMemorySigner 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         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
57703         uint64_t ret_ref = 0;
57704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57706         return ret_ref;
57707 }
57708
57709 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
57710         LDKInMemorySigner this_arg_conv;
57711         this_arg_conv.inner = untag_ptr(this_arg);
57712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57714         this_arg_conv.is_owned = false;
57715         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
57716         uint64_t ret_ref = 0;
57717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57719         return ret_ref;
57720 }
57721
57722 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
57723         LDKInMemorySigner this_arg_conv;
57724         this_arg_conv.inner = untag_ptr(this_arg);
57725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57727         this_arg_conv.is_owned = false;
57728         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
57729         uint64_t ret_ref = 0;
57730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57732         return ret_ref;
57733 }
57734
57735 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) {
57736         LDKInMemorySigner this_arg_conv;
57737         this_arg_conv.inner = untag_ptr(this_arg);
57738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57740         this_arg_conv.is_owned = false;
57741         LDKTransaction spend_tx_ref;
57742         spend_tx_ref.datalen = spend_tx->arr_len;
57743         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
57744         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
57745         spend_tx_ref.data_is_owned = true;
57746         LDKStaticPaymentOutputDescriptor descriptor_conv;
57747         descriptor_conv.inner = untag_ptr(descriptor);
57748         descriptor_conv.is_owned = ptr_is_owned(descriptor);
57749         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
57750         descriptor_conv.is_owned = false;
57751         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
57752         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
57753         return tag_ptr(ret_conv, true);
57754 }
57755
57756 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) {
57757         LDKInMemorySigner this_arg_conv;
57758         this_arg_conv.inner = untag_ptr(this_arg);
57759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57761         this_arg_conv.is_owned = false;
57762         LDKTransaction spend_tx_ref;
57763         spend_tx_ref.datalen = spend_tx->arr_len;
57764         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
57765         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
57766         spend_tx_ref.data_is_owned = true;
57767         LDKDelayedPaymentOutputDescriptor descriptor_conv;
57768         descriptor_conv.inner = untag_ptr(descriptor);
57769         descriptor_conv.is_owned = ptr_is_owned(descriptor);
57770         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
57771         descriptor_conv.is_owned = false;
57772         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
57773         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
57774         return tag_ptr(ret_conv, true);
57775 }
57776
57777 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
57778         LDKInMemorySigner this_arg_conv;
57779         this_arg_conv.inner = untag_ptr(this_arg);
57780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57782         this_arg_conv.is_owned = false;
57783         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
57784         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
57785         return tag_ptr(ret_ret, true);
57786 }
57787
57788 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
57789         LDKInMemorySigner this_arg_conv;
57790         this_arg_conv.inner = untag_ptr(this_arg);
57791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57793         this_arg_conv.is_owned = false;
57794         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
57795         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
57796         return tag_ptr(ret_ret, true);
57797 }
57798
57799 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
57800         LDKInMemorySigner this_arg_conv;
57801         this_arg_conv.inner = untag_ptr(this_arg);
57802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57804         this_arg_conv.is_owned = false;
57805         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
57806         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
57807         return tag_ptr(ret_ret, true);
57808 }
57809
57810 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
57811         LDKInMemorySigner 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         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
57817         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
57818         return tag_ptr(ret_ret, true);
57819 }
57820
57821 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
57822         LDKInMemorySigner obj_conv;
57823         obj_conv.inner = untag_ptr(obj);
57824         obj_conv.is_owned = ptr_is_owned(obj);
57825         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57826         obj_conv.is_owned = false;
57827         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
57828         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57829         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57830         CVec_u8Z_free(ret_var);
57831         return ret_arr;
57832 }
57833
57834 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
57835         LDKu8slice ser_ref;
57836         ser_ref.datalen = ser->arr_len;
57837         ser_ref.data = ser->elems;
57838         void* arg_ptr = untag_ptr(arg);
57839         CHECK_ACCESS(arg_ptr);
57840         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
57841         if (arg_conv.free == LDKEntropySource_JCalls_free) {
57842                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57843                 LDKEntropySource_JCalls_cloned(&arg_conv);
57844         }
57845         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
57846         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
57847         FREE(ser);
57848         return tag_ptr(ret_conv, true);
57849 }
57850
57851 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
57852         LDKKeysManager this_obj_conv;
57853         this_obj_conv.inner = untag_ptr(this_obj);
57854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57856         KeysManager_free(this_obj_conv);
57857 }
57858
57859 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
57860         uint8_t seed_arr[32];
57861         CHECK(seed->arr_len == 32);
57862         memcpy(seed_arr, seed->elems, 32); FREE(seed);
57863         uint8_t (*seed_ref)[32] = &seed_arr;
57864         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
57865         uint64_t ret_ref = 0;
57866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57868         return ret_ref;
57869 }
57870
57871 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
57872         LDKKeysManager this_arg_conv;
57873         this_arg_conv.inner = untag_ptr(this_arg);
57874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57876         this_arg_conv.is_owned = false;
57877         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57878         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
57879         return ret_arr;
57880 }
57881
57882 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) {
57883         LDKKeysManager this_arg_conv;
57884         this_arg_conv.inner = untag_ptr(this_arg);
57885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57887         this_arg_conv.is_owned = false;
57888         uint8_t params_arr[32];
57889         CHECK(params->arr_len == 32);
57890         memcpy(params_arr, params->elems, 32); FREE(params);
57891         uint8_t (*params_ref)[32] = &params_arr;
57892         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
57893         uint64_t ret_ref = 0;
57894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57896         return ret_ref;
57897 }
57898
57899 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) {
57900         LDKKeysManager this_arg_conv;
57901         this_arg_conv.inner = untag_ptr(this_arg);
57902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57904         this_arg_conv.is_owned = false;
57905         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
57906         descriptors_constr.datalen = descriptors->arr_len;
57907         if (descriptors_constr.datalen > 0)
57908                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
57909         else
57910                 descriptors_constr.data = NULL;
57911         uint64_t* descriptors_vals = descriptors->elems;
57912         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
57913                 uint64_t descriptors_conv_27 = descriptors_vals[b];
57914                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
57915                 CHECK_ACCESS(descriptors_conv_27_ptr);
57916                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
57917                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
57918                 descriptors_constr.data[b] = descriptors_conv_27_conv;
57919         }
57920         FREE(descriptors);
57921         LDKCVec_u8Z psbt_ref;
57922         psbt_ref.datalen = psbt->arr_len;
57923         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
57924         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
57925         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
57926         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
57927         return tag_ptr(ret_conv, true);
57928 }
57929
57930 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) {
57931         LDKKeysManager this_arg_conv;
57932         this_arg_conv.inner = untag_ptr(this_arg);
57933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57935         this_arg_conv.is_owned = false;
57936         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
57937         descriptors_constr.datalen = descriptors->arr_len;
57938         if (descriptors_constr.datalen > 0)
57939                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
57940         else
57941                 descriptors_constr.data = NULL;
57942         uint64_t* descriptors_vals = descriptors->elems;
57943         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
57944                 uint64_t descriptors_conv_27 = descriptors_vals[b];
57945                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
57946                 CHECK_ACCESS(descriptors_conv_27_ptr);
57947                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
57948                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
57949                 descriptors_constr.data[b] = descriptors_conv_27_conv;
57950         }
57951         FREE(descriptors);
57952         LDKCVec_TxOutZ outputs_constr;
57953         outputs_constr.datalen = outputs->arr_len;
57954         if (outputs_constr.datalen > 0)
57955                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
57956         else
57957                 outputs_constr.data = NULL;
57958         uint64_t* outputs_vals = outputs->elems;
57959         for (size_t h = 0; h < outputs_constr.datalen; h++) {
57960                 uint64_t outputs_conv_7 = outputs_vals[h];
57961                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
57962                 CHECK_ACCESS(outputs_conv_7_ptr);
57963                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
57964                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
57965                 outputs_constr.data[h] = outputs_conv_7_conv;
57966         }
57967         FREE(outputs);
57968         LDKCVec_u8Z change_destination_script_ref;
57969         change_destination_script_ref.datalen = change_destination_script->arr_len;
57970         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
57971         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
57972         void* locktime_ptr = untag_ptr(locktime);
57973         CHECK_ACCESS(locktime_ptr);
57974         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
57975         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
57976         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
57977         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
57978         return tag_ptr(ret_conv, true);
57979 }
57980
57981 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
57982         LDKKeysManager 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         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
57988         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
57989         return tag_ptr(ret_ret, true);
57990 }
57991
57992 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
57993         LDKKeysManager this_arg_conv;
57994         this_arg_conv.inner = untag_ptr(this_arg);
57995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57997         this_arg_conv.is_owned = false;
57998         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
57999         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
58000         return tag_ptr(ret_ret, true);
58001 }
58002
58003 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
58004         LDKKeysManager this_arg_conv;
58005         this_arg_conv.inner = untag_ptr(this_arg);
58006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58008         this_arg_conv.is_owned = false;
58009         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
58010         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
58011         return tag_ptr(ret_ret, true);
58012 }
58013
58014 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
58015         LDKPhantomKeysManager this_obj_conv;
58016         this_obj_conv.inner = untag_ptr(this_obj);
58017         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58019         PhantomKeysManager_free(this_obj_conv);
58020 }
58021
58022 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
58023         LDKPhantomKeysManager this_arg_conv;
58024         this_arg_conv.inner = untag_ptr(this_arg);
58025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58027         this_arg_conv.is_owned = false;
58028         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
58029         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
58030         return tag_ptr(ret_ret, true);
58031 }
58032
58033 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
58034         LDKPhantomKeysManager this_arg_conv;
58035         this_arg_conv.inner = untag_ptr(this_arg);
58036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58038         this_arg_conv.is_owned = false;
58039         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
58040         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
58041         return tag_ptr(ret_ret, true);
58042 }
58043
58044 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
58045         LDKPhantomKeysManager this_arg_conv;
58046         this_arg_conv.inner = untag_ptr(this_arg);
58047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58049         this_arg_conv.is_owned = false;
58050         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
58051         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
58052         return tag_ptr(ret_ret, true);
58053 }
58054
58055 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) {
58056         uint8_t seed_arr[32];
58057         CHECK(seed->arr_len == 32);
58058         memcpy(seed_arr, seed->elems, 32); FREE(seed);
58059         uint8_t (*seed_ref)[32] = &seed_arr;
58060         uint8_t cross_node_seed_arr[32];
58061         CHECK(cross_node_seed->arr_len == 32);
58062         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
58063         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
58064         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
58065         uint64_t ret_ref = 0;
58066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58068         return ret_ref;
58069 }
58070
58071 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) {
58072         LDKPhantomKeysManager this_arg_conv;
58073         this_arg_conv.inner = untag_ptr(this_arg);
58074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58076         this_arg_conv.is_owned = false;
58077         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
58078         descriptors_constr.datalen = descriptors->arr_len;
58079         if (descriptors_constr.datalen > 0)
58080                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
58081         else
58082                 descriptors_constr.data = NULL;
58083         uint64_t* descriptors_vals = descriptors->elems;
58084         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
58085                 uint64_t descriptors_conv_27 = descriptors_vals[b];
58086                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
58087                 CHECK_ACCESS(descriptors_conv_27_ptr);
58088                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
58089                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
58090                 descriptors_constr.data[b] = descriptors_conv_27_conv;
58091         }
58092         FREE(descriptors);
58093         LDKCVec_TxOutZ outputs_constr;
58094         outputs_constr.datalen = outputs->arr_len;
58095         if (outputs_constr.datalen > 0)
58096                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
58097         else
58098                 outputs_constr.data = NULL;
58099         uint64_t* outputs_vals = outputs->elems;
58100         for (size_t h = 0; h < outputs_constr.datalen; h++) {
58101                 uint64_t outputs_conv_7 = outputs_vals[h];
58102                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
58103                 CHECK_ACCESS(outputs_conv_7_ptr);
58104                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
58105                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
58106                 outputs_constr.data[h] = outputs_conv_7_conv;
58107         }
58108         FREE(outputs);
58109         LDKCVec_u8Z change_destination_script_ref;
58110         change_destination_script_ref.datalen = change_destination_script->arr_len;
58111         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
58112         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
58113         void* locktime_ptr = untag_ptr(locktime);
58114         CHECK_ACCESS(locktime_ptr);
58115         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
58116         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
58117         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
58118         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
58119         return tag_ptr(ret_conv, true);
58120 }
58121
58122 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) {
58123         LDKPhantomKeysManager this_arg_conv;
58124         this_arg_conv.inner = untag_ptr(this_arg);
58125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58127         this_arg_conv.is_owned = false;
58128         uint8_t params_arr[32];
58129         CHECK(params->arr_len == 32);
58130         memcpy(params_arr, params->elems, 32); FREE(params);
58131         uint8_t (*params_ref)[32] = &params_arr;
58132         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
58133         uint64_t ret_ref = 0;
58134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58136         return ret_ref;
58137 }
58138
58139 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
58140         LDKPhantomKeysManager this_arg_conv;
58141         this_arg_conv.inner = untag_ptr(this_arg);
58142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58144         this_arg_conv.is_owned = false;
58145         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58146         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
58147         return ret_arr;
58148 }
58149
58150 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
58151         LDKPhantomKeysManager this_arg_conv;
58152         this_arg_conv.inner = untag_ptr(this_arg);
58153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58155         this_arg_conv.is_owned = false;
58156         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58157         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
58158         return ret_arr;
58159 }
58160
58161 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
58162         LDKOnionMessenger this_obj_conv;
58163         this_obj_conv.inner = untag_ptr(this_obj);
58164         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58166         OnionMessenger_free(this_obj_conv);
58167 }
58168
58169 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
58170         if (!ptr_is_owned(this_ptr)) return;
58171         void* this_ptr_ptr = untag_ptr(this_ptr);
58172         CHECK_ACCESS(this_ptr_ptr);
58173         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
58174         FREE(untag_ptr(this_ptr));
58175         MessageRouter_free(this_ptr_conv);
58176 }
58177
58178 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
58179         LDKDefaultMessageRouter this_obj_conv;
58180         this_obj_conv.inner = untag_ptr(this_obj);
58181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58183         DefaultMessageRouter_free(this_obj_conv);
58184 }
58185
58186 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new() {
58187         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
58188         uint64_t ret_ref = 0;
58189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58191         return ret_ref;
58192 }
58193
58194 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
58195         LDKDefaultMessageRouter this_arg_conv;
58196         this_arg_conv.inner = untag_ptr(this_arg);
58197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58199         this_arg_conv.is_owned = false;
58200         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
58201         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
58202         return tag_ptr(ret_ret, true);
58203 }
58204
58205 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
58206         LDKOnionMessagePath this_obj_conv;
58207         this_obj_conv.inner = untag_ptr(this_obj);
58208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58210         OnionMessagePath_free(this_obj_conv);
58211 }
58212
58213 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
58214         LDKOnionMessagePath this_ptr_conv;
58215         this_ptr_conv.inner = untag_ptr(this_ptr);
58216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58218         this_ptr_conv.is_owned = false;
58219         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
58220         ptrArray ret_arr = NULL;
58221         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
58222         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
58223         for (size_t m = 0; m < ret_var.datalen; m++) {
58224                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
58225                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
58226                 ret_arr_ptr[m] = ret_conv_12_arr;
58227         }
58228         
58229         FREE(ret_var.data);
58230         return ret_arr;
58231 }
58232
58233 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
58234         LDKOnionMessagePath this_ptr_conv;
58235         this_ptr_conv.inner = untag_ptr(this_ptr);
58236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58238         this_ptr_conv.is_owned = false;
58239         LDKCVec_PublicKeyZ val_constr;
58240         val_constr.datalen = val->arr_len;
58241         if (val_constr.datalen > 0)
58242                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
58243         else
58244                 val_constr.data = NULL;
58245         int8_tArray* val_vals = (void*) val->elems;
58246         for (size_t m = 0; m < val_constr.datalen; m++) {
58247                 int8_tArray val_conv_12 = val_vals[m];
58248                 LDKPublicKey val_conv_12_ref;
58249                 CHECK(val_conv_12->arr_len == 33);
58250                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
58251                 val_constr.data[m] = val_conv_12_ref;
58252         }
58253         FREE(val);
58254         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
58255 }
58256
58257 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
58258         LDKOnionMessagePath this_ptr_conv;
58259         this_ptr_conv.inner = untag_ptr(this_ptr);
58260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58262         this_ptr_conv.is_owned = false;
58263         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58264         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
58265         uint64_t ret_ref = tag_ptr(ret_copy, true);
58266         return ret_ref;
58267 }
58268
58269 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
58270         LDKOnionMessagePath this_ptr_conv;
58271         this_ptr_conv.inner = untag_ptr(this_ptr);
58272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58274         this_ptr_conv.is_owned = false;
58275         void* val_ptr = untag_ptr(val);
58276         CHECK_ACCESS(val_ptr);
58277         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
58278         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
58279         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
58280 }
58281
58282 uint64_t  __attribute__((export_name("TS_OnionMessagePath_new"))) TS_OnionMessagePath_new(ptrArray intermediate_nodes_arg, uint64_t destination_arg) {
58283         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
58284         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
58285         if (intermediate_nodes_arg_constr.datalen > 0)
58286                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
58287         else
58288                 intermediate_nodes_arg_constr.data = NULL;
58289         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
58290         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
58291                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
58292                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
58293                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
58294                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
58295                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
58296         }
58297         FREE(intermediate_nodes_arg);
58298         void* destination_arg_ptr = untag_ptr(destination_arg);
58299         CHECK_ACCESS(destination_arg_ptr);
58300         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
58301         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
58302         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
58303         uint64_t ret_ref = 0;
58304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58306         return ret_ref;
58307 }
58308
58309 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
58310         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
58311         uint64_t ret_ref = 0;
58312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58314         return ret_ref;
58315 }
58316 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
58317         LDKOnionMessagePath arg_conv;
58318         arg_conv.inner = untag_ptr(arg);
58319         arg_conv.is_owned = ptr_is_owned(arg);
58320         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58321         arg_conv.is_owned = false;
58322         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
58323         return ret_conv;
58324 }
58325
58326 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
58327         LDKOnionMessagePath orig_conv;
58328         orig_conv.inner = untag_ptr(orig);
58329         orig_conv.is_owned = ptr_is_owned(orig);
58330         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58331         orig_conv.is_owned = false;
58332         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
58333         uint64_t ret_ref = 0;
58334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58336         return ret_ref;
58337 }
58338
58339 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
58340         if (!ptr_is_owned(this_ptr)) return;
58341         void* this_ptr_ptr = untag_ptr(this_ptr);
58342         CHECK_ACCESS(this_ptr_ptr);
58343         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
58344         FREE(untag_ptr(this_ptr));
58345         Destination_free(this_ptr_conv);
58346 }
58347
58348 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
58349         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58350         *ret_copy = Destination_clone(arg);
58351         uint64_t ret_ref = tag_ptr(ret_copy, true);
58352         return ret_ref;
58353 }
58354 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
58355         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
58356         int64_t ret_conv = Destination_clone_ptr(arg_conv);
58357         return ret_conv;
58358 }
58359
58360 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
58361         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
58362         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58363         *ret_copy = Destination_clone(orig_conv);
58364         uint64_t ret_ref = tag_ptr(ret_copy, true);
58365         return ret_ref;
58366 }
58367
58368 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
58369         LDKPublicKey a_ref;
58370         CHECK(a->arr_len == 33);
58371         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
58372         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58373         *ret_copy = Destination_node(a_ref);
58374         uint64_t ret_ref = tag_ptr(ret_copy, true);
58375         return ret_ref;
58376 }
58377
58378 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
58379         LDKBlindedPath a_conv;
58380         a_conv.inner = untag_ptr(a);
58381         a_conv.is_owned = ptr_is_owned(a);
58382         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58383         a_conv = BlindedPath_clone(&a_conv);
58384         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58385         *ret_copy = Destination_blinded_path(a_conv);
58386         uint64_t ret_ref = tag_ptr(ret_copy, true);
58387         return ret_ref;
58388 }
58389
58390 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
58391         if (!ptr_is_owned(this_ptr)) return;
58392         void* this_ptr_ptr = untag_ptr(this_ptr);
58393         CHECK_ACCESS(this_ptr_ptr);
58394         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
58395         FREE(untag_ptr(this_ptr));
58396         SendError_free(this_ptr_conv);
58397 }
58398
58399 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
58400         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58401         *ret_copy = SendError_clone(arg);
58402         uint64_t ret_ref = tag_ptr(ret_copy, true);
58403         return ret_ref;
58404 }
58405 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
58406         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
58407         int64_t ret_conv = SendError_clone_ptr(arg_conv);
58408         return ret_conv;
58409 }
58410
58411 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
58412         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
58413         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58414         *ret_copy = SendError_clone(orig_conv);
58415         uint64_t ret_ref = tag_ptr(ret_copy, true);
58416         return ret_ref;
58417 }
58418
58419 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
58420         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
58421         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58422         *ret_copy = SendError_secp256k1(a_conv);
58423         uint64_t ret_ref = tag_ptr(ret_copy, true);
58424         return ret_ref;
58425 }
58426
58427 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
58428         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58429         *ret_copy = SendError_too_big_packet();
58430         uint64_t ret_ref = tag_ptr(ret_copy, true);
58431         return ret_ref;
58432 }
58433
58434 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
58435         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58436         *ret_copy = SendError_too_few_blinded_hops();
58437         uint64_t ret_ref = tag_ptr(ret_copy, true);
58438         return ret_ref;
58439 }
58440
58441 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
58442         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58443         *ret_copy = SendError_invalid_first_hop();
58444         uint64_t ret_ref = tag_ptr(ret_copy, true);
58445         return ret_ref;
58446 }
58447
58448 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
58449         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58450         *ret_copy = SendError_invalid_message();
58451         uint64_t ret_ref = tag_ptr(ret_copy, true);
58452         return ret_ref;
58453 }
58454
58455 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
58456         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58457         *ret_copy = SendError_buffer_full();
58458         uint64_t ret_ref = tag_ptr(ret_copy, true);
58459         return ret_ref;
58460 }
58461
58462 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
58463         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58464         *ret_copy = SendError_get_node_id_failed();
58465         uint64_t ret_ref = tag_ptr(ret_copy, true);
58466         return ret_ref;
58467 }
58468
58469 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
58470         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58471         *ret_copy = SendError_blinded_path_advance_failed();
58472         uint64_t ret_ref = tag_ptr(ret_copy, true);
58473         return ret_ref;
58474 }
58475
58476 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
58477         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
58478         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
58479         jboolean ret_conv = SendError_eq(a_conv, b_conv);
58480         return ret_conv;
58481 }
58482
58483 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
58484         if (!ptr_is_owned(this_ptr)) return;
58485         void* this_ptr_ptr = untag_ptr(this_ptr);
58486         CHECK_ACCESS(this_ptr_ptr);
58487         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
58488         FREE(untag_ptr(this_ptr));
58489         CustomOnionMessageHandler_free(this_ptr_conv);
58490 }
58491
58492 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) {
58493         void* entropy_source_ptr = untag_ptr(entropy_source);
58494         CHECK_ACCESS(entropy_source_ptr);
58495         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
58496         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
58497                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58498                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
58499         }
58500         void* node_signer_ptr = untag_ptr(node_signer);
58501         CHECK_ACCESS(node_signer_ptr);
58502         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
58503         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
58504                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58505                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
58506         }
58507         void* logger_ptr = untag_ptr(logger);
58508         CHECK_ACCESS(logger_ptr);
58509         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
58510         if (logger_conv.free == LDKLogger_JCalls_free) {
58511                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58512                 LDKLogger_JCalls_cloned(&logger_conv);
58513         }
58514         void* message_router_ptr = untag_ptr(message_router);
58515         CHECK_ACCESS(message_router_ptr);
58516         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
58517         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
58518                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58519                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
58520         }
58521         void* offers_handler_ptr = untag_ptr(offers_handler);
58522         CHECK_ACCESS(offers_handler_ptr);
58523         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
58524         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
58525                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58526                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
58527         }
58528         void* custom_handler_ptr = untag_ptr(custom_handler);
58529         CHECK_ACCESS(custom_handler_ptr);
58530         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
58531         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
58532                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58533                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
58534         }
58535         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
58536         uint64_t ret_ref = 0;
58537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58539         return ret_ref;
58540 }
58541
58542 uint64_t  __attribute__((export_name("TS_OnionMessenger_send_onion_message"))) TS_OnionMessenger_send_onion_message(uint64_t this_arg, uint64_t path, uint64_t message, uint64_t reply_path) {
58543         LDKOnionMessenger this_arg_conv;
58544         this_arg_conv.inner = untag_ptr(this_arg);
58545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58547         this_arg_conv.is_owned = false;
58548         LDKOnionMessagePath path_conv;
58549         path_conv.inner = untag_ptr(path);
58550         path_conv.is_owned = ptr_is_owned(path);
58551         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
58552         path_conv = OnionMessagePath_clone(&path_conv);
58553         void* message_ptr = untag_ptr(message);
58554         CHECK_ACCESS(message_ptr);
58555         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
58556         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
58557         LDKBlindedPath reply_path_conv;
58558         reply_path_conv.inner = untag_ptr(reply_path);
58559         reply_path_conv.is_owned = ptr_is_owned(reply_path);
58560         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
58561         reply_path_conv = BlindedPath_clone(&reply_path_conv);
58562         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
58563         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, message_conv, reply_path_conv);
58564         return tag_ptr(ret_conv, true);
58565 }
58566
58567 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
58568         LDKOnionMessenger this_arg_conv;
58569         this_arg_conv.inner = untag_ptr(this_arg);
58570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58572         this_arg_conv.is_owned = false;
58573         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
58574         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
58575         return tag_ptr(ret_ret, true);
58576 }
58577
58578 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
58579         LDKOnionMessenger this_arg_conv;
58580         this_arg_conv.inner = untag_ptr(this_arg);
58581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58583         this_arg_conv.is_owned = false;
58584         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
58585         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
58586         return tag_ptr(ret_ret, true);
58587 }
58588
58589 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
58590         if (!ptr_is_owned(this_ptr)) return;
58591         void* this_ptr_ptr = untag_ptr(this_ptr);
58592         CHECK_ACCESS(this_ptr_ptr);
58593         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
58594         FREE(untag_ptr(this_ptr));
58595         OffersMessageHandler_free(this_ptr_conv);
58596 }
58597
58598 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
58599         if (!ptr_is_owned(this_ptr)) return;
58600         void* this_ptr_ptr = untag_ptr(this_ptr);
58601         CHECK_ACCESS(this_ptr_ptr);
58602         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
58603         FREE(untag_ptr(this_ptr));
58604         OffersMessage_free(this_ptr_conv);
58605 }
58606
58607 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
58608         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58609         *ret_copy = OffersMessage_clone(arg);
58610         uint64_t ret_ref = tag_ptr(ret_copy, true);
58611         return ret_ref;
58612 }
58613 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
58614         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
58615         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
58616         return ret_conv;
58617 }
58618
58619 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
58620         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
58621         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58622         *ret_copy = OffersMessage_clone(orig_conv);
58623         uint64_t ret_ref = tag_ptr(ret_copy, true);
58624         return ret_ref;
58625 }
58626
58627 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
58628         LDKInvoiceRequest a_conv;
58629         a_conv.inner = untag_ptr(a);
58630         a_conv.is_owned = ptr_is_owned(a);
58631         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58632         a_conv = InvoiceRequest_clone(&a_conv);
58633         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58634         *ret_copy = OffersMessage_invoice_request(a_conv);
58635         uint64_t ret_ref = tag_ptr(ret_copy, true);
58636         return ret_ref;
58637 }
58638
58639 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
58640         LDKBolt12Invoice a_conv;
58641         a_conv.inner = untag_ptr(a);
58642         a_conv.is_owned = ptr_is_owned(a);
58643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58644         a_conv = Bolt12Invoice_clone(&a_conv);
58645         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58646         *ret_copy = OffersMessage_invoice(a_conv);
58647         uint64_t ret_ref = tag_ptr(ret_copy, true);
58648         return ret_ref;
58649 }
58650
58651 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
58652         LDKInvoiceError a_conv;
58653         a_conv.inner = untag_ptr(a);
58654         a_conv.is_owned = ptr_is_owned(a);
58655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58656         a_conv = InvoiceError_clone(&a_conv);
58657         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58658         *ret_copy = OffersMessage_invoice_error(a_conv);
58659         uint64_t ret_ref = tag_ptr(ret_copy, true);
58660         return ret_ref;
58661 }
58662
58663 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
58664         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
58665         return ret_conv;
58666 }
58667
58668 int64_t  __attribute__((export_name("TS_OffersMessage_tlv_type"))) TS_OffersMessage_tlv_type(uint64_t this_arg) {
58669         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
58670         int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv);
58671         return ret_conv;
58672 }
58673
58674 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
58675         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
58676         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
58677         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58678         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58679         CVec_u8Z_free(ret_var);
58680         return ret_arr;
58681 }
58682
58683 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
58684         LDKu8slice ser_ref;
58685         ser_ref.datalen = ser->arr_len;
58686         ser_ref.data = ser->elems;
58687         void* arg_b_ptr = untag_ptr(arg_b);
58688         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
58689         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
58690         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
58691         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
58692         FREE(ser);
58693         return tag_ptr(ret_conv, true);
58694 }
58695
58696 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
58697         if (!ptr_is_owned(this_ptr)) return;
58698         void* this_ptr_ptr = untag_ptr(this_ptr);
58699         CHECK_ACCESS(this_ptr_ptr);
58700         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
58701         FREE(untag_ptr(this_ptr));
58702         OnionMessageContents_free(this_ptr_conv);
58703 }
58704
58705 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
58706         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
58707         *ret_copy = OnionMessageContents_clone(arg);
58708         uint64_t ret_ref = tag_ptr(ret_copy, true);
58709         return ret_ref;
58710 }
58711 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
58712         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
58713         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
58714         return ret_conv;
58715 }
58716
58717 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
58718         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
58719         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
58720         *ret_copy = OnionMessageContents_clone(orig_conv);
58721         uint64_t ret_ref = tag_ptr(ret_copy, true);
58722         return ret_ref;
58723 }
58724
58725 uint64_t  __attribute__((export_name("TS_OnionMessageContents_offers"))) TS_OnionMessageContents_offers(uint64_t a) {
58726         void* a_ptr = untag_ptr(a);
58727         CHECK_ACCESS(a_ptr);
58728         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
58729         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
58730         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
58731         *ret_copy = OnionMessageContents_offers(a_conv);
58732         uint64_t ret_ref = tag_ptr(ret_copy, true);
58733         return ret_ref;
58734 }
58735
58736 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
58737         void* a_ptr = untag_ptr(a);
58738         CHECK_ACCESS(a_ptr);
58739         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
58740         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
58741                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58742                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
58743         }
58744         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
58745         *ret_copy = OnionMessageContents_custom(a_conv);
58746         uint64_t ret_ref = tag_ptr(ret_copy, true);
58747         return ret_ref;
58748 }
58749
58750 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
58751         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
58752         *ret_ret = CustomOnionMessageContents_clone(arg);
58753         return tag_ptr(ret_ret, true);
58754 }
58755 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
58756         void* arg_ptr = untag_ptr(arg);
58757         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
58758         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
58759         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
58760         return ret_conv;
58761 }
58762
58763 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
58764         void* orig_ptr = untag_ptr(orig);
58765         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
58766         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
58767         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
58768         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
58769         return tag_ptr(ret_ret, true);
58770 }
58771
58772 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
58773         if (!ptr_is_owned(this_ptr)) return;
58774         void* this_ptr_ptr = untag_ptr(this_ptr);
58775         CHECK_ACCESS(this_ptr_ptr);
58776         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
58777         FREE(untag_ptr(this_ptr));
58778         CustomOnionMessageContents_free(this_ptr_conv);
58779 }
58780
58781 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
58782         LDKBlindedPath this_obj_conv;
58783         this_obj_conv.inner = untag_ptr(this_obj);
58784         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58786         BlindedPath_free(this_obj_conv);
58787 }
58788
58789 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
58790         LDKBlindedPath ret_var = BlindedPath_clone(arg);
58791         uint64_t ret_ref = 0;
58792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58794         return ret_ref;
58795 }
58796 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
58797         LDKBlindedPath arg_conv;
58798         arg_conv.inner = untag_ptr(arg);
58799         arg_conv.is_owned = ptr_is_owned(arg);
58800         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58801         arg_conv.is_owned = false;
58802         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
58803         return ret_conv;
58804 }
58805
58806 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
58807         LDKBlindedPath orig_conv;
58808         orig_conv.inner = untag_ptr(orig);
58809         orig_conv.is_owned = ptr_is_owned(orig);
58810         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58811         orig_conv.is_owned = false;
58812         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
58813         uint64_t ret_ref = 0;
58814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58816         return ret_ref;
58817 }
58818
58819 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
58820         LDKBlindedPath o_conv;
58821         o_conv.inner = untag_ptr(o);
58822         o_conv.is_owned = ptr_is_owned(o);
58823         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58824         o_conv.is_owned = false;
58825         int64_t ret_conv = BlindedPath_hash(&o_conv);
58826         return ret_conv;
58827 }
58828
58829 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
58830         LDKBlindedPath a_conv;
58831         a_conv.inner = untag_ptr(a);
58832         a_conv.is_owned = ptr_is_owned(a);
58833         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58834         a_conv.is_owned = false;
58835         LDKBlindedPath b_conv;
58836         b_conv.inner = untag_ptr(b);
58837         b_conv.is_owned = ptr_is_owned(b);
58838         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58839         b_conv.is_owned = false;
58840         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
58841         return ret_conv;
58842 }
58843
58844 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
58845         LDKBlindedHop this_obj_conv;
58846         this_obj_conv.inner = untag_ptr(this_obj);
58847         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58849         BlindedHop_free(this_obj_conv);
58850 }
58851
58852 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
58853         LDKBlindedHop ret_var = BlindedHop_clone(arg);
58854         uint64_t ret_ref = 0;
58855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58857         return ret_ref;
58858 }
58859 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
58860         LDKBlindedHop arg_conv;
58861         arg_conv.inner = untag_ptr(arg);
58862         arg_conv.is_owned = ptr_is_owned(arg);
58863         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58864         arg_conv.is_owned = false;
58865         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
58866         return ret_conv;
58867 }
58868
58869 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
58870         LDKBlindedHop orig_conv;
58871         orig_conv.inner = untag_ptr(orig);
58872         orig_conv.is_owned = ptr_is_owned(orig);
58873         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58874         orig_conv.is_owned = false;
58875         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
58876         uint64_t ret_ref = 0;
58877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58879         return ret_ref;
58880 }
58881
58882 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
58883         LDKBlindedHop o_conv;
58884         o_conv.inner = untag_ptr(o);
58885         o_conv.is_owned = ptr_is_owned(o);
58886         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58887         o_conv.is_owned = false;
58888         int64_t ret_conv = BlindedHop_hash(&o_conv);
58889         return ret_conv;
58890 }
58891
58892 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
58893         LDKBlindedHop a_conv;
58894         a_conv.inner = untag_ptr(a);
58895         a_conv.is_owned = ptr_is_owned(a);
58896         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58897         a_conv.is_owned = false;
58898         LDKBlindedHop b_conv;
58899         b_conv.inner = untag_ptr(b);
58900         b_conv.is_owned = ptr_is_owned(b);
58901         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58902         b_conv.is_owned = false;
58903         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
58904         return ret_conv;
58905 }
58906
58907 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
58908         LDKCVec_PublicKeyZ node_pks_constr;
58909         node_pks_constr.datalen = node_pks->arr_len;
58910         if (node_pks_constr.datalen > 0)
58911                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
58912         else
58913                 node_pks_constr.data = NULL;
58914         int8_tArray* node_pks_vals = (void*) node_pks->elems;
58915         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
58916                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
58917                 LDKPublicKey node_pks_conv_12_ref;
58918                 CHECK(node_pks_conv_12->arr_len == 33);
58919                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
58920                 node_pks_constr.data[m] = node_pks_conv_12_ref;
58921         }
58922         FREE(node_pks);
58923         void* entropy_source_ptr = untag_ptr(entropy_source);
58924         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
58925         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
58926         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
58927         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
58928         return tag_ptr(ret_conv, true);
58929 }
58930
58931 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
58932         LDKBlindedPath obj_conv;
58933         obj_conv.inner = untag_ptr(obj);
58934         obj_conv.is_owned = ptr_is_owned(obj);
58935         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58936         obj_conv.is_owned = false;
58937         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
58938         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58939         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58940         CVec_u8Z_free(ret_var);
58941         return ret_arr;
58942 }
58943
58944 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
58945         LDKu8slice ser_ref;
58946         ser_ref.datalen = ser->arr_len;
58947         ser_ref.data = ser->elems;
58948         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
58949         *ret_conv = BlindedPath_read(ser_ref);
58950         FREE(ser);
58951         return tag_ptr(ret_conv, true);
58952 }
58953
58954 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
58955         LDKBlindedHop obj_conv;
58956         obj_conv.inner = untag_ptr(obj);
58957         obj_conv.is_owned = ptr_is_owned(obj);
58958         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58959         obj_conv.is_owned = false;
58960         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
58961         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58962         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58963         CVec_u8Z_free(ret_var);
58964         return ret_arr;
58965 }
58966
58967 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
58968         LDKu8slice ser_ref;
58969         ser_ref.datalen = ser->arr_len;
58970         ser_ref.data = ser->elems;
58971         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
58972         *ret_conv = BlindedHop_read(ser_ref);
58973         FREE(ser);
58974         return tag_ptr(ret_conv, true);
58975 }
58976
58977 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
58978         if (!ptr_is_owned(this_ptr)) return;
58979         void* this_ptr_ptr = untag_ptr(this_ptr);
58980         CHECK_ACCESS(this_ptr_ptr);
58981         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
58982         FREE(untag_ptr(this_ptr));
58983         PaymentPurpose_free(this_ptr_conv);
58984 }
58985
58986 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
58987         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
58988         *ret_copy = PaymentPurpose_clone(arg);
58989         uint64_t ret_ref = tag_ptr(ret_copy, true);
58990         return ret_ref;
58991 }
58992 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
58993         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
58994         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
58995         return ret_conv;
58996 }
58997
58998 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
58999         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
59000         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
59001         *ret_copy = PaymentPurpose_clone(orig_conv);
59002         uint64_t ret_ref = tag_ptr(ret_copy, true);
59003         return ret_ref;
59004 }
59005
59006 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
59007         void* payment_preimage_ptr = untag_ptr(payment_preimage);
59008         CHECK_ACCESS(payment_preimage_ptr);
59009         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
59010         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
59011         LDKThirtyTwoBytes payment_secret_ref;
59012         CHECK(payment_secret->arr_len == 32);
59013         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
59014         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
59015         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
59016         uint64_t ret_ref = tag_ptr(ret_copy, true);
59017         return ret_ref;
59018 }
59019
59020 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
59021         LDKThirtyTwoBytes a_ref;
59022         CHECK(a->arr_len == 32);
59023         memcpy(a_ref.data, a->elems, 32); FREE(a);
59024         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
59025         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
59026         uint64_t ret_ref = tag_ptr(ret_copy, true);
59027         return ret_ref;
59028 }
59029
59030 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
59031         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
59032         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
59033         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
59034         return ret_conv;
59035 }
59036
59037 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
59038         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
59039         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
59040         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59041         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59042         CVec_u8Z_free(ret_var);
59043         return ret_arr;
59044 }
59045
59046 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
59047         LDKu8slice ser_ref;
59048         ser_ref.datalen = ser->arr_len;
59049         ser_ref.data = ser->elems;
59050         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
59051         *ret_conv = PaymentPurpose_read(ser_ref);
59052         FREE(ser);
59053         return tag_ptr(ret_conv, true);
59054 }
59055
59056 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
59057         if (!ptr_is_owned(this_ptr)) return;
59058         void* this_ptr_ptr = untag_ptr(this_ptr);
59059         CHECK_ACCESS(this_ptr_ptr);
59060         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
59061         FREE(untag_ptr(this_ptr));
59062         PathFailure_free(this_ptr_conv);
59063 }
59064
59065 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
59066         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
59067         *ret_copy = PathFailure_clone(arg);
59068         uint64_t ret_ref = tag_ptr(ret_copy, true);
59069         return ret_ref;
59070 }
59071 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
59072         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
59073         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
59074         return ret_conv;
59075 }
59076
59077 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
59078         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
59079         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
59080         *ret_copy = PathFailure_clone(orig_conv);
59081         uint64_t ret_ref = tag_ptr(ret_copy, true);
59082         return ret_ref;
59083 }
59084
59085 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
59086         void* err_ptr = untag_ptr(err);
59087         CHECK_ACCESS(err_ptr);
59088         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
59089         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
59090         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
59091         *ret_copy = PathFailure_initial_send(err_conv);
59092         uint64_t ret_ref = tag_ptr(ret_copy, true);
59093         return ret_ref;
59094 }
59095
59096 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
59097         void* network_update_ptr = untag_ptr(network_update);
59098         CHECK_ACCESS(network_update_ptr);
59099         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
59100         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
59101         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
59102         *ret_copy = PathFailure_on_path(network_update_conv);
59103         uint64_t ret_ref = tag_ptr(ret_copy, true);
59104         return ret_ref;
59105 }
59106
59107 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
59108         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
59109         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
59110         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
59111         return ret_conv;
59112 }
59113
59114 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
59115         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
59116         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
59117         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59118         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59119         CVec_u8Z_free(ret_var);
59120         return ret_arr;
59121 }
59122
59123 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
59124         LDKu8slice ser_ref;
59125         ser_ref.datalen = ser->arr_len;
59126         ser_ref.data = ser->elems;
59127         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
59128         *ret_conv = PathFailure_read(ser_ref);
59129         FREE(ser);
59130         return tag_ptr(ret_conv, true);
59131 }
59132
59133 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
59134         if (!ptr_is_owned(this_ptr)) return;
59135         void* this_ptr_ptr = untag_ptr(this_ptr);
59136         CHECK_ACCESS(this_ptr_ptr);
59137         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
59138         FREE(untag_ptr(this_ptr));
59139         ClosureReason_free(this_ptr_conv);
59140 }
59141
59142 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
59143         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59144         *ret_copy = ClosureReason_clone(arg);
59145         uint64_t ret_ref = tag_ptr(ret_copy, true);
59146         return ret_ref;
59147 }
59148 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
59149         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
59150         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
59151         return ret_conv;
59152 }
59153
59154 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
59155         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
59156         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59157         *ret_copy = ClosureReason_clone(orig_conv);
59158         uint64_t ret_ref = tag_ptr(ret_copy, true);
59159         return ret_ref;
59160 }
59161
59162 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
59163         LDKUntrustedString peer_msg_conv;
59164         peer_msg_conv.inner = untag_ptr(peer_msg);
59165         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
59166         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
59167         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
59168         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59169         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
59170         uint64_t ret_ref = tag_ptr(ret_copy, true);
59171         return ret_ref;
59172 }
59173
59174 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
59175         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59176         *ret_copy = ClosureReason_holder_force_closed();
59177         uint64_t ret_ref = tag_ptr(ret_copy, true);
59178         return ret_ref;
59179 }
59180
59181 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
59182         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59183         *ret_copy = ClosureReason_cooperative_closure();
59184         uint64_t ret_ref = tag_ptr(ret_copy, true);
59185         return ret_ref;
59186 }
59187
59188 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
59189         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59190         *ret_copy = ClosureReason_commitment_tx_confirmed();
59191         uint64_t ret_ref = tag_ptr(ret_copy, true);
59192         return ret_ref;
59193 }
59194
59195 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
59196         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59197         *ret_copy = ClosureReason_funding_timed_out();
59198         uint64_t ret_ref = tag_ptr(ret_copy, true);
59199         return ret_ref;
59200 }
59201
59202 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
59203         LDKStr err_conv = str_ref_to_owned_c(err);
59204         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59205         *ret_copy = ClosureReason_processing_error(err_conv);
59206         uint64_t ret_ref = tag_ptr(ret_copy, true);
59207         return ret_ref;
59208 }
59209
59210 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
59211         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59212         *ret_copy = ClosureReason_disconnected_peer();
59213         uint64_t ret_ref = tag_ptr(ret_copy, true);
59214         return ret_ref;
59215 }
59216
59217 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
59218         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59219         *ret_copy = ClosureReason_outdated_channel_manager();
59220         uint64_t ret_ref = tag_ptr(ret_copy, true);
59221         return ret_ref;
59222 }
59223
59224 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
59225         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59226         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
59227         uint64_t ret_ref = tag_ptr(ret_copy, true);
59228         return ret_ref;
59229 }
59230
59231 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
59232         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
59233         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
59234         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
59235         return ret_conv;
59236 }
59237
59238 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
59239         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
59240         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
59241         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59242         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59243         CVec_u8Z_free(ret_var);
59244         return ret_arr;
59245 }
59246
59247 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
59248         LDKu8slice ser_ref;
59249         ser_ref.datalen = ser->arr_len;
59250         ser_ref.data = ser->elems;
59251         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
59252         *ret_conv = ClosureReason_read(ser_ref);
59253         FREE(ser);
59254         return tag_ptr(ret_conv, true);
59255 }
59256
59257 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
59258         if (!ptr_is_owned(this_ptr)) return;
59259         void* this_ptr_ptr = untag_ptr(this_ptr);
59260         CHECK_ACCESS(this_ptr_ptr);
59261         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
59262         FREE(untag_ptr(this_ptr));
59263         HTLCDestination_free(this_ptr_conv);
59264 }
59265
59266 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
59267         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59268         *ret_copy = HTLCDestination_clone(arg);
59269         uint64_t ret_ref = tag_ptr(ret_copy, true);
59270         return ret_ref;
59271 }
59272 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
59273         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
59274         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
59275         return ret_conv;
59276 }
59277
59278 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
59279         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
59280         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59281         *ret_copy = HTLCDestination_clone(orig_conv);
59282         uint64_t ret_ref = tag_ptr(ret_copy, true);
59283         return ret_ref;
59284 }
59285
59286 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
59287         LDKPublicKey node_id_ref;
59288         CHECK(node_id->arr_len == 33);
59289         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59290         LDKThirtyTwoBytes channel_id_ref;
59291         CHECK(channel_id->arr_len == 32);
59292         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59293         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59294         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
59295         uint64_t ret_ref = tag_ptr(ret_copy, true);
59296         return ret_ref;
59297 }
59298
59299 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
59300         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59301         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
59302         uint64_t ret_ref = tag_ptr(ret_copy, true);
59303         return ret_ref;
59304 }
59305
59306 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
59307         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59308         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
59309         uint64_t ret_ref = tag_ptr(ret_copy, true);
59310         return ret_ref;
59311 }
59312
59313 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
59314         LDKThirtyTwoBytes payment_hash_ref;
59315         CHECK(payment_hash->arr_len == 32);
59316         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59317         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59318         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
59319         uint64_t ret_ref = tag_ptr(ret_copy, true);
59320         return ret_ref;
59321 }
59322
59323 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
59324         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
59325         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
59326         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
59327         return ret_conv;
59328 }
59329
59330 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
59331         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
59332         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
59333         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59334         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59335         CVec_u8Z_free(ret_var);
59336         return ret_arr;
59337 }
59338
59339 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
59340         LDKu8slice ser_ref;
59341         ser_ref.datalen = ser->arr_len;
59342         ser_ref.data = ser->elems;
59343         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
59344         *ret_conv = HTLCDestination_read(ser_ref);
59345         FREE(ser);
59346         return tag_ptr(ret_conv, true);
59347 }
59348
59349 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
59350         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
59351         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
59352         return ret_conv;
59353 }
59354
59355 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
59356         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
59357         return ret_conv;
59358 }
59359
59360 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
59361         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
59362         return ret_conv;
59363 }
59364
59365 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
59366         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
59367         return ret_conv;
59368 }
59369
59370 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
59371         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
59372         return ret_conv;
59373 }
59374
59375 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
59376         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
59377         return ret_conv;
59378 }
59379
59380 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
59381         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
59382         return ret_conv;
59383 }
59384
59385 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
59386         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
59387         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
59388         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
59389         return ret_conv;
59390 }
59391
59392 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
59393         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
59394         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
59395         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59396         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59397         CVec_u8Z_free(ret_var);
59398         return ret_arr;
59399 }
59400
59401 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
59402         LDKu8slice ser_ref;
59403         ser_ref.datalen = ser->arr_len;
59404         ser_ref.data = ser->elems;
59405         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
59406         *ret_conv = PaymentFailureReason_read(ser_ref);
59407         FREE(ser);
59408         return tag_ptr(ret_conv, true);
59409 }
59410
59411 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
59412         if (!ptr_is_owned(this_ptr)) return;
59413         void* this_ptr_ptr = untag_ptr(this_ptr);
59414         CHECK_ACCESS(this_ptr_ptr);
59415         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
59416         FREE(untag_ptr(this_ptr));
59417         Event_free(this_ptr_conv);
59418 }
59419
59420 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
59421         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59422         *ret_copy = Event_clone(arg);
59423         uint64_t ret_ref = tag_ptr(ret_copy, true);
59424         return ret_ref;
59425 }
59426 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
59427         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
59428         int64_t ret_conv = Event_clone_ptr(arg_conv);
59429         return ret_conv;
59430 }
59431
59432 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
59433         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
59434         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59435         *ret_copy = Event_clone(orig_conv);
59436         uint64_t ret_ref = tag_ptr(ret_copy, true);
59437         return ret_ref;
59438 }
59439
59440 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) {
59441         LDKThirtyTwoBytes temporary_channel_id_ref;
59442         CHECK(temporary_channel_id->arr_len == 32);
59443         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
59444         LDKPublicKey counterparty_node_id_ref;
59445         CHECK(counterparty_node_id->arr_len == 33);
59446         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
59447         LDKCVec_u8Z output_script_ref;
59448         output_script_ref.datalen = output_script->arr_len;
59449         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
59450         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
59451         LDKU128 user_channel_id_ref;
59452         CHECK(user_channel_id->arr_len == 16);
59453         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
59454         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59455         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
59456         uint64_t ret_ref = tag_ptr(ret_copy, true);
59457         return ret_ref;
59458 }
59459
59460 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, int8_tArray via_channel_id, uint64_t via_user_channel_id, uint64_t claim_deadline) {
59461         LDKPublicKey receiver_node_id_ref;
59462         CHECK(receiver_node_id->arr_len == 33);
59463         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
59464         LDKThirtyTwoBytes payment_hash_ref;
59465         CHECK(payment_hash->arr_len == 32);
59466         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59467         LDKRecipientOnionFields onion_fields_conv;
59468         onion_fields_conv.inner = untag_ptr(onion_fields);
59469         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
59470         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
59471         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
59472         void* purpose_ptr = untag_ptr(purpose);
59473         CHECK_ACCESS(purpose_ptr);
59474         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
59475         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
59476         LDKThirtyTwoBytes via_channel_id_ref;
59477         CHECK(via_channel_id->arr_len == 32);
59478         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
59479         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
59480         CHECK_ACCESS(via_user_channel_id_ptr);
59481         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
59482         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
59483         void* claim_deadline_ptr = untag_ptr(claim_deadline);
59484         CHECK_ACCESS(claim_deadline_ptr);
59485         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
59486         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
59487         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59488         *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_ref, via_user_channel_id_conv, claim_deadline_conv);
59489         uint64_t ret_ref = tag_ptr(ret_copy, true);
59490         return ret_ref;
59491 }
59492
59493 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) {
59494         LDKPublicKey receiver_node_id_ref;
59495         CHECK(receiver_node_id->arr_len == 33);
59496         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
59497         LDKThirtyTwoBytes payment_hash_ref;
59498         CHECK(payment_hash->arr_len == 32);
59499         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59500         void* purpose_ptr = untag_ptr(purpose);
59501         CHECK_ACCESS(purpose_ptr);
59502         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
59503         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
59504         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59505         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
59506         uint64_t ret_ref = tag_ptr(ret_copy, true);
59507         return ret_ref;
59508 }
59509
59510 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) {
59511         void* payment_id_ptr = untag_ptr(payment_id);
59512         CHECK_ACCESS(payment_id_ptr);
59513         LDKCOption_PaymentIdZ payment_id_conv = *(LDKCOption_PaymentIdZ*)(payment_id_ptr);
59514         payment_id_conv = COption_PaymentIdZ_clone((LDKCOption_PaymentIdZ*)untag_ptr(payment_id));
59515         LDKThirtyTwoBytes payment_preimage_ref;
59516         CHECK(payment_preimage->arr_len == 32);
59517         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
59518         LDKThirtyTwoBytes payment_hash_ref;
59519         CHECK(payment_hash->arr_len == 32);
59520         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59521         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
59522         CHECK_ACCESS(fee_paid_msat_ptr);
59523         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
59524         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
59525         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59526         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
59527         uint64_t ret_ref = tag_ptr(ret_copy, true);
59528         return ret_ref;
59529 }
59530
59531 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
59532         LDKThirtyTwoBytes payment_id_ref;
59533         CHECK(payment_id->arr_len == 32);
59534         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
59535         LDKThirtyTwoBytes payment_hash_ref;
59536         CHECK(payment_hash->arr_len == 32);
59537         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59538         void* reason_ptr = untag_ptr(reason);
59539         CHECK_ACCESS(reason_ptr);
59540         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
59541         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
59542         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59543         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
59544         uint64_t ret_ref = tag_ptr(ret_copy, true);
59545         return ret_ref;
59546 }
59547
59548 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) {
59549         LDKThirtyTwoBytes payment_id_ref;
59550         CHECK(payment_id->arr_len == 32);
59551         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
59552         void* payment_hash_ptr = untag_ptr(payment_hash);
59553         CHECK_ACCESS(payment_hash_ptr);
59554         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
59555         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
59556         LDKPath path_conv;
59557         path_conv.inner = untag_ptr(path);
59558         path_conv.is_owned = ptr_is_owned(path);
59559         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59560         path_conv = Path_clone(&path_conv);
59561         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59562         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
59563         uint64_t ret_ref = tag_ptr(ret_copy, true);
59564         return ret_ref;
59565 }
59566
59567 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) {
59568         void* payment_id_ptr = untag_ptr(payment_id);
59569         CHECK_ACCESS(payment_id_ptr);
59570         LDKCOption_PaymentIdZ payment_id_conv = *(LDKCOption_PaymentIdZ*)(payment_id_ptr);
59571         payment_id_conv = COption_PaymentIdZ_clone((LDKCOption_PaymentIdZ*)untag_ptr(payment_id));
59572         LDKThirtyTwoBytes payment_hash_ref;
59573         CHECK(payment_hash->arr_len == 32);
59574         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59575         void* failure_ptr = untag_ptr(failure);
59576         CHECK_ACCESS(failure_ptr);
59577         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
59578         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
59579         LDKPath path_conv;
59580         path_conv.inner = untag_ptr(path);
59581         path_conv.is_owned = ptr_is_owned(path);
59582         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59583         path_conv = Path_clone(&path_conv);
59584         void* short_channel_id_ptr = untag_ptr(short_channel_id);
59585         CHECK_ACCESS(short_channel_id_ptr);
59586         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
59587         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
59588         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59589         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
59590         uint64_t ret_ref = tag_ptr(ret_copy, true);
59591         return ret_ref;
59592 }
59593
59594 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
59595         LDKThirtyTwoBytes payment_id_ref;
59596         CHECK(payment_id->arr_len == 32);
59597         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
59598         LDKThirtyTwoBytes payment_hash_ref;
59599         CHECK(payment_hash->arr_len == 32);
59600         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59601         LDKPath path_conv;
59602         path_conv.inner = untag_ptr(path);
59603         path_conv.is_owned = ptr_is_owned(path);
59604         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59605         path_conv = Path_clone(&path_conv);
59606         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59607         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
59608         uint64_t ret_ref = tag_ptr(ret_copy, true);
59609         return ret_ref;
59610 }
59611
59612 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) {
59613         LDKThirtyTwoBytes payment_id_ref;
59614         CHECK(payment_id->arr_len == 32);
59615         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
59616         LDKThirtyTwoBytes payment_hash_ref;
59617         CHECK(payment_hash->arr_len == 32);
59618         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59619         LDKPath path_conv;
59620         path_conv.inner = untag_ptr(path);
59621         path_conv.is_owned = ptr_is_owned(path);
59622         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59623         path_conv = Path_clone(&path_conv);
59624         void* short_channel_id_ptr = untag_ptr(short_channel_id);
59625         CHECK_ACCESS(short_channel_id_ptr);
59626         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
59627         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
59628         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59629         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
59630         uint64_t ret_ref = tag_ptr(ret_copy, true);
59631         return ret_ref;
59632 }
59633
59634 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
59635         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59636         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
59637         uint64_t ret_ref = tag_ptr(ret_copy, true);
59638         return ret_ref;
59639 }
59640
59641 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) {
59642         LDKThirtyTwoBytes intercept_id_ref;
59643         CHECK(intercept_id->arr_len == 32);
59644         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
59645         LDKThirtyTwoBytes payment_hash_ref;
59646         CHECK(payment_hash->arr_len == 32);
59647         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59648         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59649         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
59650         uint64_t ret_ref = tag_ptr(ret_copy, true);
59651         return ret_ref;
59652 }
59653
59654 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
59655         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
59656         outputs_constr.datalen = outputs->arr_len;
59657         if (outputs_constr.datalen > 0)
59658                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
59659         else
59660                 outputs_constr.data = NULL;
59661         uint64_t* outputs_vals = outputs->elems;
59662         for (size_t b = 0; b < outputs_constr.datalen; b++) {
59663                 uint64_t outputs_conv_27 = outputs_vals[b];
59664                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
59665                 CHECK_ACCESS(outputs_conv_27_ptr);
59666                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
59667                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
59668                 outputs_constr.data[b] = outputs_conv_27_conv;
59669         }
59670         FREE(outputs);
59671         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59672         *ret_copy = Event_spendable_outputs(outputs_constr);
59673         uint64_t ret_ref = tag_ptr(ret_copy, true);
59674         return ret_ref;
59675 }
59676
59677 uint64_t  __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(int8_tArray prev_channel_id, int8_tArray next_channel_id, uint64_t fee_earned_msat, jboolean claim_from_onchain_tx, uint64_t outbound_amount_forwarded_msat) {
59678         LDKThirtyTwoBytes prev_channel_id_ref;
59679         CHECK(prev_channel_id->arr_len == 32);
59680         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
59681         LDKThirtyTwoBytes next_channel_id_ref;
59682         CHECK(next_channel_id->arr_len == 32);
59683         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
59684         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
59685         CHECK_ACCESS(fee_earned_msat_ptr);
59686         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
59687         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
59688         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
59689         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
59690         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
59691         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
59692         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59693         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
59694         uint64_t ret_ref = tag_ptr(ret_copy, true);
59695         return ret_ref;
59696 }
59697
59698 uint64_t  __attribute__((export_name("TS_Event_channel_pending"))) TS_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray former_temporary_channel_id, int8_tArray counterparty_node_id, uint64_t funding_txo) {
59699         LDKThirtyTwoBytes channel_id_ref;
59700         CHECK(channel_id->arr_len == 32);
59701         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59702         LDKU128 user_channel_id_ref;
59703         CHECK(user_channel_id->arr_len == 16);
59704         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
59705         LDKThirtyTwoBytes former_temporary_channel_id_ref;
59706         CHECK(former_temporary_channel_id->arr_len == 32);
59707         memcpy(former_temporary_channel_id_ref.data, former_temporary_channel_id->elems, 32); FREE(former_temporary_channel_id);
59708         LDKPublicKey counterparty_node_id_ref;
59709         CHECK(counterparty_node_id->arr_len == 33);
59710         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
59711         LDKOutPoint funding_txo_conv;
59712         funding_txo_conv.inner = untag_ptr(funding_txo);
59713         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
59714         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
59715         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
59716         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59717         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
59718         uint64_t ret_ref = tag_ptr(ret_copy, true);
59719         return ret_ref;
59720 }
59721
59722 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) {
59723         LDKThirtyTwoBytes channel_id_ref;
59724         CHECK(channel_id->arr_len == 32);
59725         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59726         LDKU128 user_channel_id_ref;
59727         CHECK(user_channel_id->arr_len == 16);
59728         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
59729         LDKPublicKey counterparty_node_id_ref;
59730         CHECK(counterparty_node_id->arr_len == 33);
59731         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
59732         LDKChannelTypeFeatures channel_type_conv;
59733         channel_type_conv.inner = untag_ptr(channel_type);
59734         channel_type_conv.is_owned = ptr_is_owned(channel_type);
59735         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
59736         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
59737         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59738         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
59739         uint64_t ret_ref = tag_ptr(ret_copy, true);
59740         return ret_ref;
59741 }
59742
59743 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) {
59744         LDKThirtyTwoBytes channel_id_ref;
59745         CHECK(channel_id->arr_len == 32);
59746         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59747         LDKU128 user_channel_id_ref;
59748         CHECK(user_channel_id->arr_len == 16);
59749         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
59750         void* reason_ptr = untag_ptr(reason);
59751         CHECK_ACCESS(reason_ptr);
59752         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
59753         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
59754         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59755         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
59756         uint64_t ret_ref = tag_ptr(ret_copy, true);
59757         return ret_ref;
59758 }
59759
59760 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
59761         LDKThirtyTwoBytes channel_id_ref;
59762         CHECK(channel_id->arr_len == 32);
59763         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59764         LDKTransaction transaction_ref;
59765         transaction_ref.datalen = transaction->arr_len;
59766         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
59767         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
59768         transaction_ref.data_is_owned = true;
59769         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59770         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
59771         uint64_t ret_ref = tag_ptr(ret_copy, true);
59772         return ret_ref;
59773 }
59774
59775 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) {
59776         LDKThirtyTwoBytes temporary_channel_id_ref;
59777         CHECK(temporary_channel_id->arr_len == 32);
59778         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
59779         LDKPublicKey counterparty_node_id_ref;
59780         CHECK(counterparty_node_id->arr_len == 33);
59781         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
59782         LDKChannelTypeFeatures channel_type_conv;
59783         channel_type_conv.inner = untag_ptr(channel_type);
59784         channel_type_conv.is_owned = ptr_is_owned(channel_type);
59785         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
59786         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
59787         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59788         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
59789         uint64_t ret_ref = tag_ptr(ret_copy, true);
59790         return ret_ref;
59791 }
59792
59793 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
59794         LDKThirtyTwoBytes prev_channel_id_ref;
59795         CHECK(prev_channel_id->arr_len == 32);
59796         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
59797         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
59798         CHECK_ACCESS(failed_next_destination_ptr);
59799         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
59800         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
59801         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59802         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
59803         uint64_t ret_ref = tag_ptr(ret_copy, true);
59804         return ret_ref;
59805 }
59806
59807 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
59808         void* a_ptr = untag_ptr(a);
59809         CHECK_ACCESS(a_ptr);
59810         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
59811         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
59812         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59813         *ret_copy = Event_bump_transaction(a_conv);
59814         uint64_t ret_ref = tag_ptr(ret_copy, true);
59815         return ret_ref;
59816 }
59817
59818 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
59819         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
59820         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
59821         jboolean ret_conv = Event_eq(a_conv, b_conv);
59822         return ret_conv;
59823 }
59824
59825 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
59826         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
59827         LDKCVec_u8Z ret_var = Event_write(obj_conv);
59828         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59829         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59830         CVec_u8Z_free(ret_var);
59831         return ret_arr;
59832 }
59833
59834 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
59835         LDKu8slice ser_ref;
59836         ser_ref.datalen = ser->arr_len;
59837         ser_ref.data = ser->elems;
59838         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
59839         *ret_conv = Event_read(ser_ref);
59840         FREE(ser);
59841         return tag_ptr(ret_conv, true);
59842 }
59843
59844 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
59845         if (!ptr_is_owned(this_ptr)) return;
59846         void* this_ptr_ptr = untag_ptr(this_ptr);
59847         CHECK_ACCESS(this_ptr_ptr);
59848         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
59849         FREE(untag_ptr(this_ptr));
59850         MessageSendEvent_free(this_ptr_conv);
59851 }
59852
59853 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
59854         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59855         *ret_copy = MessageSendEvent_clone(arg);
59856         uint64_t ret_ref = tag_ptr(ret_copy, true);
59857         return ret_ref;
59858 }
59859 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
59860         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
59861         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
59862         return ret_conv;
59863 }
59864
59865 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
59866         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
59867         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59868         *ret_copy = MessageSendEvent_clone(orig_conv);
59869         uint64_t ret_ref = tag_ptr(ret_copy, true);
59870         return ret_ref;
59871 }
59872
59873 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
59874         LDKPublicKey node_id_ref;
59875         CHECK(node_id->arr_len == 33);
59876         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59877         LDKAcceptChannel msg_conv;
59878         msg_conv.inner = untag_ptr(msg);
59879         msg_conv.is_owned = ptr_is_owned(msg);
59880         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59881         msg_conv = AcceptChannel_clone(&msg_conv);
59882         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59883         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
59884         uint64_t ret_ref = tag_ptr(ret_copy, true);
59885         return ret_ref;
59886 }
59887
59888 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
59889         LDKPublicKey node_id_ref;
59890         CHECK(node_id->arr_len == 33);
59891         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59892         LDKAcceptChannelV2 msg_conv;
59893         msg_conv.inner = untag_ptr(msg);
59894         msg_conv.is_owned = ptr_is_owned(msg);
59895         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59896         msg_conv = AcceptChannelV2_clone(&msg_conv);
59897         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59898         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
59899         uint64_t ret_ref = tag_ptr(ret_copy, true);
59900         return ret_ref;
59901 }
59902
59903 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
59904         LDKPublicKey node_id_ref;
59905         CHECK(node_id->arr_len == 33);
59906         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59907         LDKOpenChannel msg_conv;
59908         msg_conv.inner = untag_ptr(msg);
59909         msg_conv.is_owned = ptr_is_owned(msg);
59910         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59911         msg_conv = OpenChannel_clone(&msg_conv);
59912         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59913         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
59914         uint64_t ret_ref = tag_ptr(ret_copy, true);
59915         return ret_ref;
59916 }
59917
59918 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
59919         LDKPublicKey node_id_ref;
59920         CHECK(node_id->arr_len == 33);
59921         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59922         LDKOpenChannelV2 msg_conv;
59923         msg_conv.inner = untag_ptr(msg);
59924         msg_conv.is_owned = ptr_is_owned(msg);
59925         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59926         msg_conv = OpenChannelV2_clone(&msg_conv);
59927         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59928         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
59929         uint64_t ret_ref = tag_ptr(ret_copy, true);
59930         return ret_ref;
59931 }
59932
59933 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
59934         LDKPublicKey node_id_ref;
59935         CHECK(node_id->arr_len == 33);
59936         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59937         LDKFundingCreated msg_conv;
59938         msg_conv.inner = untag_ptr(msg);
59939         msg_conv.is_owned = ptr_is_owned(msg);
59940         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59941         msg_conv = FundingCreated_clone(&msg_conv);
59942         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59943         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
59944         uint64_t ret_ref = tag_ptr(ret_copy, true);
59945         return ret_ref;
59946 }
59947
59948 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
59949         LDKPublicKey node_id_ref;
59950         CHECK(node_id->arr_len == 33);
59951         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59952         LDKFundingSigned msg_conv;
59953         msg_conv.inner = untag_ptr(msg);
59954         msg_conv.is_owned = ptr_is_owned(msg);
59955         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59956         msg_conv = FundingSigned_clone(&msg_conv);
59957         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59958         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
59959         uint64_t ret_ref = tag_ptr(ret_copy, true);
59960         return ret_ref;
59961 }
59962
59963 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
59964         LDKPublicKey node_id_ref;
59965         CHECK(node_id->arr_len == 33);
59966         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59967         LDKTxAddInput msg_conv;
59968         msg_conv.inner = untag_ptr(msg);
59969         msg_conv.is_owned = ptr_is_owned(msg);
59970         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59971         msg_conv = TxAddInput_clone(&msg_conv);
59972         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59973         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
59974         uint64_t ret_ref = tag_ptr(ret_copy, true);
59975         return ret_ref;
59976 }
59977
59978 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
59979         LDKPublicKey node_id_ref;
59980         CHECK(node_id->arr_len == 33);
59981         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59982         LDKTxAddOutput msg_conv;
59983         msg_conv.inner = untag_ptr(msg);
59984         msg_conv.is_owned = ptr_is_owned(msg);
59985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59986         msg_conv = TxAddOutput_clone(&msg_conv);
59987         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59988         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
59989         uint64_t ret_ref = tag_ptr(ret_copy, true);
59990         return ret_ref;
59991 }
59992
59993 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
59994         LDKPublicKey node_id_ref;
59995         CHECK(node_id->arr_len == 33);
59996         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59997         LDKTxRemoveInput msg_conv;
59998         msg_conv.inner = untag_ptr(msg);
59999         msg_conv.is_owned = ptr_is_owned(msg);
60000         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60001         msg_conv = TxRemoveInput_clone(&msg_conv);
60002         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60003         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
60004         uint64_t ret_ref = tag_ptr(ret_copy, true);
60005         return ret_ref;
60006 }
60007
60008 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
60009         LDKPublicKey node_id_ref;
60010         CHECK(node_id->arr_len == 33);
60011         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60012         LDKTxRemoveOutput msg_conv;
60013         msg_conv.inner = untag_ptr(msg);
60014         msg_conv.is_owned = ptr_is_owned(msg);
60015         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60016         msg_conv = TxRemoveOutput_clone(&msg_conv);
60017         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60018         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
60019         uint64_t ret_ref = tag_ptr(ret_copy, true);
60020         return ret_ref;
60021 }
60022
60023 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
60024         LDKPublicKey node_id_ref;
60025         CHECK(node_id->arr_len == 33);
60026         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60027         LDKTxComplete msg_conv;
60028         msg_conv.inner = untag_ptr(msg);
60029         msg_conv.is_owned = ptr_is_owned(msg);
60030         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60031         msg_conv = TxComplete_clone(&msg_conv);
60032         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60033         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
60034         uint64_t ret_ref = tag_ptr(ret_copy, true);
60035         return ret_ref;
60036 }
60037
60038 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
60039         LDKPublicKey node_id_ref;
60040         CHECK(node_id->arr_len == 33);
60041         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60042         LDKTxSignatures msg_conv;
60043         msg_conv.inner = untag_ptr(msg);
60044         msg_conv.is_owned = ptr_is_owned(msg);
60045         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60046         msg_conv = TxSignatures_clone(&msg_conv);
60047         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60048         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
60049         uint64_t ret_ref = tag_ptr(ret_copy, true);
60050         return ret_ref;
60051 }
60052
60053 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
60054         LDKPublicKey node_id_ref;
60055         CHECK(node_id->arr_len == 33);
60056         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60057         LDKTxInitRbf msg_conv;
60058         msg_conv.inner = untag_ptr(msg);
60059         msg_conv.is_owned = ptr_is_owned(msg);
60060         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60061         msg_conv = TxInitRbf_clone(&msg_conv);
60062         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60063         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
60064         uint64_t ret_ref = tag_ptr(ret_copy, true);
60065         return ret_ref;
60066 }
60067
60068 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
60069         LDKPublicKey node_id_ref;
60070         CHECK(node_id->arr_len == 33);
60071         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60072         LDKTxAckRbf msg_conv;
60073         msg_conv.inner = untag_ptr(msg);
60074         msg_conv.is_owned = ptr_is_owned(msg);
60075         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60076         msg_conv = TxAckRbf_clone(&msg_conv);
60077         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60078         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
60079         uint64_t ret_ref = tag_ptr(ret_copy, true);
60080         return ret_ref;
60081 }
60082
60083 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
60084         LDKPublicKey node_id_ref;
60085         CHECK(node_id->arr_len == 33);
60086         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60087         LDKTxAddInput msg_conv;
60088         msg_conv.inner = untag_ptr(msg);
60089         msg_conv.is_owned = ptr_is_owned(msg);
60090         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60091         msg_conv = TxAddInput_clone(&msg_conv);
60092         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60093         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
60094         uint64_t ret_ref = tag_ptr(ret_copy, true);
60095         return ret_ref;
60096 }
60097
60098 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
60099         LDKPublicKey node_id_ref;
60100         CHECK(node_id->arr_len == 33);
60101         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60102         LDKChannelReady msg_conv;
60103         msg_conv.inner = untag_ptr(msg);
60104         msg_conv.is_owned = ptr_is_owned(msg);
60105         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60106         msg_conv = ChannelReady_clone(&msg_conv);
60107         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60108         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
60109         uint64_t ret_ref = tag_ptr(ret_copy, true);
60110         return ret_ref;
60111 }
60112
60113 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
60114         LDKPublicKey node_id_ref;
60115         CHECK(node_id->arr_len == 33);
60116         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60117         LDKAnnouncementSignatures msg_conv;
60118         msg_conv.inner = untag_ptr(msg);
60119         msg_conv.is_owned = ptr_is_owned(msg);
60120         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60121         msg_conv = AnnouncementSignatures_clone(&msg_conv);
60122         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60123         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
60124         uint64_t ret_ref = tag_ptr(ret_copy, true);
60125         return ret_ref;
60126 }
60127
60128 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
60129         LDKPublicKey node_id_ref;
60130         CHECK(node_id->arr_len == 33);
60131         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60132         LDKCommitmentUpdate updates_conv;
60133         updates_conv.inner = untag_ptr(updates);
60134         updates_conv.is_owned = ptr_is_owned(updates);
60135         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
60136         updates_conv = CommitmentUpdate_clone(&updates_conv);
60137         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60138         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
60139         uint64_t ret_ref = tag_ptr(ret_copy, true);
60140         return ret_ref;
60141 }
60142
60143 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
60144         LDKPublicKey node_id_ref;
60145         CHECK(node_id->arr_len == 33);
60146         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60147         LDKRevokeAndACK msg_conv;
60148         msg_conv.inner = untag_ptr(msg);
60149         msg_conv.is_owned = ptr_is_owned(msg);
60150         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60151         msg_conv = RevokeAndACK_clone(&msg_conv);
60152         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60153         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
60154         uint64_t ret_ref = tag_ptr(ret_copy, true);
60155         return ret_ref;
60156 }
60157
60158 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
60159         LDKPublicKey node_id_ref;
60160         CHECK(node_id->arr_len == 33);
60161         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60162         LDKClosingSigned msg_conv;
60163         msg_conv.inner = untag_ptr(msg);
60164         msg_conv.is_owned = ptr_is_owned(msg);
60165         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60166         msg_conv = ClosingSigned_clone(&msg_conv);
60167         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60168         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
60169         uint64_t ret_ref = tag_ptr(ret_copy, true);
60170         return ret_ref;
60171 }
60172
60173 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
60174         LDKPublicKey node_id_ref;
60175         CHECK(node_id->arr_len == 33);
60176         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60177         LDKShutdown msg_conv;
60178         msg_conv.inner = untag_ptr(msg);
60179         msg_conv.is_owned = ptr_is_owned(msg);
60180         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60181         msg_conv = Shutdown_clone(&msg_conv);
60182         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60183         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
60184         uint64_t ret_ref = tag_ptr(ret_copy, true);
60185         return ret_ref;
60186 }
60187
60188 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
60189         LDKPublicKey node_id_ref;
60190         CHECK(node_id->arr_len == 33);
60191         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60192         LDKChannelReestablish msg_conv;
60193         msg_conv.inner = untag_ptr(msg);
60194         msg_conv.is_owned = ptr_is_owned(msg);
60195         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60196         msg_conv = ChannelReestablish_clone(&msg_conv);
60197         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60198         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
60199         uint64_t ret_ref = tag_ptr(ret_copy, true);
60200         return ret_ref;
60201 }
60202
60203 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) {
60204         LDKPublicKey node_id_ref;
60205         CHECK(node_id->arr_len == 33);
60206         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60207         LDKChannelAnnouncement msg_conv;
60208         msg_conv.inner = untag_ptr(msg);
60209         msg_conv.is_owned = ptr_is_owned(msg);
60210         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60211         msg_conv = ChannelAnnouncement_clone(&msg_conv);
60212         LDKChannelUpdate update_msg_conv;
60213         update_msg_conv.inner = untag_ptr(update_msg);
60214         update_msg_conv.is_owned = ptr_is_owned(update_msg);
60215         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
60216         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
60217         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60218         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
60219         uint64_t ret_ref = tag_ptr(ret_copy, true);
60220         return ret_ref;
60221 }
60222
60223 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
60224         LDKChannelAnnouncement msg_conv;
60225         msg_conv.inner = untag_ptr(msg);
60226         msg_conv.is_owned = ptr_is_owned(msg);
60227         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60228         msg_conv = ChannelAnnouncement_clone(&msg_conv);
60229         LDKChannelUpdate update_msg_conv;
60230         update_msg_conv.inner = untag_ptr(update_msg);
60231         update_msg_conv.is_owned = ptr_is_owned(update_msg);
60232         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
60233         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
60234         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60235         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
60236         uint64_t ret_ref = tag_ptr(ret_copy, true);
60237         return ret_ref;
60238 }
60239
60240 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
60241         LDKChannelUpdate msg_conv;
60242         msg_conv.inner = untag_ptr(msg);
60243         msg_conv.is_owned = ptr_is_owned(msg);
60244         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60245         msg_conv = ChannelUpdate_clone(&msg_conv);
60246         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60247         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
60248         uint64_t ret_ref = tag_ptr(ret_copy, true);
60249         return ret_ref;
60250 }
60251
60252 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
60253         LDKNodeAnnouncement msg_conv;
60254         msg_conv.inner = untag_ptr(msg);
60255         msg_conv.is_owned = ptr_is_owned(msg);
60256         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60257         msg_conv = NodeAnnouncement_clone(&msg_conv);
60258         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60259         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
60260         uint64_t ret_ref = tag_ptr(ret_copy, true);
60261         return ret_ref;
60262 }
60263
60264 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
60265         LDKPublicKey node_id_ref;
60266         CHECK(node_id->arr_len == 33);
60267         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60268         LDKChannelUpdate msg_conv;
60269         msg_conv.inner = untag_ptr(msg);
60270         msg_conv.is_owned = ptr_is_owned(msg);
60271         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60272         msg_conv = ChannelUpdate_clone(&msg_conv);
60273         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60274         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
60275         uint64_t ret_ref = tag_ptr(ret_copy, true);
60276         return ret_ref;
60277 }
60278
60279 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
60280         LDKPublicKey node_id_ref;
60281         CHECK(node_id->arr_len == 33);
60282         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60283         void* action_ptr = untag_ptr(action);
60284         CHECK_ACCESS(action_ptr);
60285         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
60286         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
60287         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60288         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
60289         uint64_t ret_ref = tag_ptr(ret_copy, true);
60290         return ret_ref;
60291 }
60292
60293 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
60294         LDKPublicKey node_id_ref;
60295         CHECK(node_id->arr_len == 33);
60296         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60297         LDKQueryChannelRange msg_conv;
60298         msg_conv.inner = untag_ptr(msg);
60299         msg_conv.is_owned = ptr_is_owned(msg);
60300         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60301         msg_conv = QueryChannelRange_clone(&msg_conv);
60302         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60303         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
60304         uint64_t ret_ref = tag_ptr(ret_copy, true);
60305         return ret_ref;
60306 }
60307
60308 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
60309         LDKPublicKey node_id_ref;
60310         CHECK(node_id->arr_len == 33);
60311         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60312         LDKQueryShortChannelIds msg_conv;
60313         msg_conv.inner = untag_ptr(msg);
60314         msg_conv.is_owned = ptr_is_owned(msg);
60315         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60316         msg_conv = QueryShortChannelIds_clone(&msg_conv);
60317         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60318         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
60319         uint64_t ret_ref = tag_ptr(ret_copy, true);
60320         return ret_ref;
60321 }
60322
60323 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
60324         LDKPublicKey node_id_ref;
60325         CHECK(node_id->arr_len == 33);
60326         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60327         LDKReplyChannelRange msg_conv;
60328         msg_conv.inner = untag_ptr(msg);
60329         msg_conv.is_owned = ptr_is_owned(msg);
60330         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60331         msg_conv = ReplyChannelRange_clone(&msg_conv);
60332         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60333         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
60334         uint64_t ret_ref = tag_ptr(ret_copy, true);
60335         return ret_ref;
60336 }
60337
60338 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
60339         LDKPublicKey node_id_ref;
60340         CHECK(node_id->arr_len == 33);
60341         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60342         LDKGossipTimestampFilter msg_conv;
60343         msg_conv.inner = untag_ptr(msg);
60344         msg_conv.is_owned = ptr_is_owned(msg);
60345         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60346         msg_conv = GossipTimestampFilter_clone(&msg_conv);
60347         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60348         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
60349         uint64_t ret_ref = tag_ptr(ret_copy, true);
60350         return ret_ref;
60351 }
60352
60353 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
60354         if (!ptr_is_owned(this_ptr)) return;
60355         void* this_ptr_ptr = untag_ptr(this_ptr);
60356         CHECK_ACCESS(this_ptr_ptr);
60357         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
60358         FREE(untag_ptr(this_ptr));
60359         MessageSendEventsProvider_free(this_ptr_conv);
60360 }
60361
60362 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
60363         if (!ptr_is_owned(this_ptr)) return;
60364         void* this_ptr_ptr = untag_ptr(this_ptr);
60365         CHECK_ACCESS(this_ptr_ptr);
60366         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
60367         FREE(untag_ptr(this_ptr));
60368         OnionMessageProvider_free(this_ptr_conv);
60369 }
60370
60371 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
60372         if (!ptr_is_owned(this_ptr)) return;
60373         void* this_ptr_ptr = untag_ptr(this_ptr);
60374         CHECK_ACCESS(this_ptr_ptr);
60375         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
60376         FREE(untag_ptr(this_ptr));
60377         EventsProvider_free(this_ptr_conv);
60378 }
60379
60380 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
60381         if (!ptr_is_owned(this_ptr)) return;
60382         void* this_ptr_ptr = untag_ptr(this_ptr);
60383         CHECK_ACCESS(this_ptr_ptr);
60384         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
60385         FREE(untag_ptr(this_ptr));
60386         EventHandler_free(this_ptr_conv);
60387 }
60388
60389 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
60390         LDKChannelDerivationParameters this_obj_conv;
60391         this_obj_conv.inner = untag_ptr(this_obj);
60392         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60394         ChannelDerivationParameters_free(this_obj_conv);
60395 }
60396
60397 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
60398         LDKChannelDerivationParameters this_ptr_conv;
60399         this_ptr_conv.inner = untag_ptr(this_ptr);
60400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60402         this_ptr_conv.is_owned = false;
60403         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
60404         return ret_conv;
60405 }
60406
60407 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
60408         LDKChannelDerivationParameters this_ptr_conv;
60409         this_ptr_conv.inner = untag_ptr(this_ptr);
60410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60412         this_ptr_conv.is_owned = false;
60413         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
60414 }
60415
60416 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
60417         LDKChannelDerivationParameters this_ptr_conv;
60418         this_ptr_conv.inner = untag_ptr(this_ptr);
60419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60421         this_ptr_conv.is_owned = false;
60422         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60423         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
60424         return ret_arr;
60425 }
60426
60427 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
60428         LDKChannelDerivationParameters this_ptr_conv;
60429         this_ptr_conv.inner = untag_ptr(this_ptr);
60430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60432         this_ptr_conv.is_owned = false;
60433         LDKThirtyTwoBytes val_ref;
60434         CHECK(val->arr_len == 32);
60435         memcpy(val_ref.data, val->elems, 32); FREE(val);
60436         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
60437 }
60438
60439 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
60440         LDKChannelDerivationParameters this_ptr_conv;
60441         this_ptr_conv.inner = untag_ptr(this_ptr);
60442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60444         this_ptr_conv.is_owned = false;
60445         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
60446         uint64_t ret_ref = 0;
60447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60449         return ret_ref;
60450 }
60451
60452 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
60453         LDKChannelDerivationParameters this_ptr_conv;
60454         this_ptr_conv.inner = untag_ptr(this_ptr);
60455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60457         this_ptr_conv.is_owned = false;
60458         LDKChannelTransactionParameters val_conv;
60459         val_conv.inner = untag_ptr(val);
60460         val_conv.is_owned = ptr_is_owned(val);
60461         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60462         val_conv = ChannelTransactionParameters_clone(&val_conv);
60463         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
60464 }
60465
60466 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) {
60467         LDKThirtyTwoBytes keys_id_arg_ref;
60468         CHECK(keys_id_arg->arr_len == 32);
60469         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
60470         LDKChannelTransactionParameters transaction_parameters_arg_conv;
60471         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
60472         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
60473         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
60474         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
60475         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
60476         uint64_t ret_ref = 0;
60477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60479         return ret_ref;
60480 }
60481
60482 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
60483         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
60484         uint64_t ret_ref = 0;
60485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60487         return ret_ref;
60488 }
60489 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
60490         LDKChannelDerivationParameters arg_conv;
60491         arg_conv.inner = untag_ptr(arg);
60492         arg_conv.is_owned = ptr_is_owned(arg);
60493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60494         arg_conv.is_owned = false;
60495         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
60496         return ret_conv;
60497 }
60498
60499 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
60500         LDKChannelDerivationParameters orig_conv;
60501         orig_conv.inner = untag_ptr(orig);
60502         orig_conv.is_owned = ptr_is_owned(orig);
60503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60504         orig_conv.is_owned = false;
60505         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
60506         uint64_t ret_ref = 0;
60507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60509         return ret_ref;
60510 }
60511
60512 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
60513         LDKChannelDerivationParameters a_conv;
60514         a_conv.inner = untag_ptr(a);
60515         a_conv.is_owned = ptr_is_owned(a);
60516         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60517         a_conv.is_owned = false;
60518         LDKChannelDerivationParameters b_conv;
60519         b_conv.inner = untag_ptr(b);
60520         b_conv.is_owned = ptr_is_owned(b);
60521         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60522         b_conv.is_owned = false;
60523         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
60524         return ret_conv;
60525 }
60526
60527 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
60528         LDKAnchorDescriptor this_obj_conv;
60529         this_obj_conv.inner = untag_ptr(this_obj);
60530         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60532         AnchorDescriptor_free(this_obj_conv);
60533 }
60534
60535 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
60536         LDKAnchorDescriptor this_ptr_conv;
60537         this_ptr_conv.inner = untag_ptr(this_ptr);
60538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60540         this_ptr_conv.is_owned = false;
60541         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
60542         uint64_t ret_ref = 0;
60543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60545         return ret_ref;
60546 }
60547
60548 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
60549         LDKAnchorDescriptor this_ptr_conv;
60550         this_ptr_conv.inner = untag_ptr(this_ptr);
60551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60553         this_ptr_conv.is_owned = false;
60554         LDKChannelDerivationParameters val_conv;
60555         val_conv.inner = untag_ptr(val);
60556         val_conv.is_owned = ptr_is_owned(val);
60557         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60558         val_conv = ChannelDerivationParameters_clone(&val_conv);
60559         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
60560 }
60561
60562 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
60563         LDKAnchorDescriptor this_ptr_conv;
60564         this_ptr_conv.inner = untag_ptr(this_ptr);
60565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60567         this_ptr_conv.is_owned = false;
60568         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
60569         uint64_t ret_ref = 0;
60570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60572         return ret_ref;
60573 }
60574
60575 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
60576         LDKAnchorDescriptor this_ptr_conv;
60577         this_ptr_conv.inner = untag_ptr(this_ptr);
60578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60580         this_ptr_conv.is_owned = false;
60581         LDKOutPoint val_conv;
60582         val_conv.inner = untag_ptr(val);
60583         val_conv.is_owned = ptr_is_owned(val);
60584         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60585         val_conv = OutPoint_clone(&val_conv);
60586         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
60587 }
60588
60589 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
60590         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
60591         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
60592         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
60593         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
60594         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
60595         LDKOutPoint outpoint_arg_conv;
60596         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
60597         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
60598         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
60599         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
60600         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
60601         uint64_t ret_ref = 0;
60602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60604         return ret_ref;
60605 }
60606
60607 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
60608         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
60609         uint64_t ret_ref = 0;
60610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60612         return ret_ref;
60613 }
60614 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
60615         LDKAnchorDescriptor arg_conv;
60616         arg_conv.inner = untag_ptr(arg);
60617         arg_conv.is_owned = ptr_is_owned(arg);
60618         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60619         arg_conv.is_owned = false;
60620         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
60621         return ret_conv;
60622 }
60623
60624 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
60625         LDKAnchorDescriptor orig_conv;
60626         orig_conv.inner = untag_ptr(orig);
60627         orig_conv.is_owned = ptr_is_owned(orig);
60628         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60629         orig_conv.is_owned = false;
60630         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
60631         uint64_t ret_ref = 0;
60632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60634         return ret_ref;
60635 }
60636
60637 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
60638         LDKAnchorDescriptor a_conv;
60639         a_conv.inner = untag_ptr(a);
60640         a_conv.is_owned = ptr_is_owned(a);
60641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60642         a_conv.is_owned = false;
60643         LDKAnchorDescriptor b_conv;
60644         b_conv.inner = untag_ptr(b);
60645         b_conv.is_owned = ptr_is_owned(b);
60646         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60647         b_conv.is_owned = false;
60648         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
60649         return ret_conv;
60650 }
60651
60652 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
60653         LDKAnchorDescriptor this_arg_conv;
60654         this_arg_conv.inner = untag_ptr(this_arg);
60655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60657         this_arg_conv.is_owned = false;
60658         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
60659         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
60660         return tag_ptr(ret_ref, true);
60661 }
60662
60663 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
60664         LDKAnchorDescriptor this_arg_conv;
60665         this_arg_conv.inner = untag_ptr(this_arg);
60666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60668         this_arg_conv.is_owned = false;
60669         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
60670         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
60671         return tag_ptr(ret_ref, true);
60672 }
60673
60674 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
60675         LDKAnchorDescriptor this_arg_conv;
60676         this_arg_conv.inner = untag_ptr(this_arg);
60677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60679         this_arg_conv.is_owned = false;
60680         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
60681         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60682         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60683         CVec_u8Z_free(ret_var);
60684         return ret_arr;
60685 }
60686
60687 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
60688         LDKAnchorDescriptor this_arg_conv;
60689         this_arg_conv.inner = untag_ptr(this_arg);
60690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60692         this_arg_conv.is_owned = false;
60693         LDKSignature signature_ref;
60694         CHECK(signature->arr_len == 64);
60695         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
60696         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
60697         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60698         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60699         Witness_free(ret_var);
60700         return ret_arr;
60701 }
60702
60703 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
60704         LDKAnchorDescriptor this_arg_conv;
60705         this_arg_conv.inner = untag_ptr(this_arg);
60706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60708         this_arg_conv.is_owned = false;
60709         void* signer_provider_ptr = untag_ptr(signer_provider);
60710         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
60711         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
60712         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
60713         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
60714         return tag_ptr(ret_ret, true);
60715 }
60716
60717 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
60718         LDKHTLCDescriptor this_obj_conv;
60719         this_obj_conv.inner = untag_ptr(this_obj);
60720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60722         HTLCDescriptor_free(this_obj_conv);
60723 }
60724
60725 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
60726         LDKHTLCDescriptor this_ptr_conv;
60727         this_ptr_conv.inner = untag_ptr(this_ptr);
60728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60730         this_ptr_conv.is_owned = false;
60731         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
60732         uint64_t ret_ref = 0;
60733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60735         return ret_ref;
60736 }
60737
60738 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
60739         LDKHTLCDescriptor this_ptr_conv;
60740         this_ptr_conv.inner = untag_ptr(this_ptr);
60741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60743         this_ptr_conv.is_owned = false;
60744         LDKChannelDerivationParameters val_conv;
60745         val_conv.inner = untag_ptr(val);
60746         val_conv.is_owned = ptr_is_owned(val);
60747         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60748         val_conv = ChannelDerivationParameters_clone(&val_conv);
60749         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
60750 }
60751
60752 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
60753         LDKHTLCDescriptor this_ptr_conv;
60754         this_ptr_conv.inner = untag_ptr(this_ptr);
60755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60757         this_ptr_conv.is_owned = false;
60758         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
60759         return ret_conv;
60760 }
60761
60762 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
60763         LDKHTLCDescriptor this_ptr_conv;
60764         this_ptr_conv.inner = untag_ptr(this_ptr);
60765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60767         this_ptr_conv.is_owned = false;
60768         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
60769 }
60770
60771 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
60772         LDKHTLCDescriptor this_ptr_conv;
60773         this_ptr_conv.inner = untag_ptr(this_ptr);
60774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60776         this_ptr_conv.is_owned = false;
60777         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60778         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
60779         return ret_arr;
60780 }
60781
60782 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
60783         LDKHTLCDescriptor this_ptr_conv;
60784         this_ptr_conv.inner = untag_ptr(this_ptr);
60785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60787         this_ptr_conv.is_owned = false;
60788         LDKPublicKey val_ref;
60789         CHECK(val->arr_len == 33);
60790         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
60791         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
60792 }
60793
60794 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
60795         LDKHTLCDescriptor this_ptr_conv;
60796         this_ptr_conv.inner = untag_ptr(this_ptr);
60797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60799         this_ptr_conv.is_owned = false;
60800         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
60801         uint64_t ret_ref = 0;
60802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60804         return ret_ref;
60805 }
60806
60807 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
60808         LDKHTLCDescriptor this_ptr_conv;
60809         this_ptr_conv.inner = untag_ptr(this_ptr);
60810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60812         this_ptr_conv.is_owned = false;
60813         LDKHTLCOutputInCommitment val_conv;
60814         val_conv.inner = untag_ptr(val);
60815         val_conv.is_owned = ptr_is_owned(val);
60816         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60817         val_conv = HTLCOutputInCommitment_clone(&val_conv);
60818         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
60819 }
60820
60821 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
60822         LDKHTLCDescriptor this_ptr_conv;
60823         this_ptr_conv.inner = untag_ptr(this_ptr);
60824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60826         this_ptr_conv.is_owned = false;
60827         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
60828         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
60829         uint64_t ret_ref = tag_ptr(ret_copy, true);
60830         return ret_ref;
60831 }
60832
60833 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
60834         LDKHTLCDescriptor this_ptr_conv;
60835         this_ptr_conv.inner = untag_ptr(this_ptr);
60836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60838         this_ptr_conv.is_owned = false;
60839         void* val_ptr = untag_ptr(val);
60840         CHECK_ACCESS(val_ptr);
60841         LDKCOption_PaymentPreimageZ val_conv = *(LDKCOption_PaymentPreimageZ*)(val_ptr);
60842         val_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(val));
60843         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
60844 }
60845
60846 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
60847         LDKHTLCDescriptor this_ptr_conv;
60848         this_ptr_conv.inner = untag_ptr(this_ptr);
60849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60851         this_ptr_conv.is_owned = false;
60852         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60853         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
60854         return ret_arr;
60855 }
60856
60857 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
60858         LDKHTLCDescriptor this_ptr_conv;
60859         this_ptr_conv.inner = untag_ptr(this_ptr);
60860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60862         this_ptr_conv.is_owned = false;
60863         LDKSignature val_ref;
60864         CHECK(val->arr_len == 64);
60865         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
60866         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
60867 }
60868
60869 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
60870         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
60871         uint64_t ret_ref = 0;
60872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60874         return ret_ref;
60875 }
60876 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
60877         LDKHTLCDescriptor arg_conv;
60878         arg_conv.inner = untag_ptr(arg);
60879         arg_conv.is_owned = ptr_is_owned(arg);
60880         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60881         arg_conv.is_owned = false;
60882         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
60883         return ret_conv;
60884 }
60885
60886 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
60887         LDKHTLCDescriptor orig_conv;
60888         orig_conv.inner = untag_ptr(orig);
60889         orig_conv.is_owned = ptr_is_owned(orig);
60890         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60891         orig_conv.is_owned = false;
60892         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
60893         uint64_t ret_ref = 0;
60894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60896         return ret_ref;
60897 }
60898
60899 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
60900         LDKHTLCDescriptor a_conv;
60901         a_conv.inner = untag_ptr(a);
60902         a_conv.is_owned = ptr_is_owned(a);
60903         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60904         a_conv.is_owned = false;
60905         LDKHTLCDescriptor b_conv;
60906         b_conv.inner = untag_ptr(b);
60907         b_conv.is_owned = ptr_is_owned(b);
60908         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60909         b_conv.is_owned = false;
60910         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
60911         return ret_conv;
60912 }
60913
60914 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
60915         LDKHTLCDescriptor this_arg_conv;
60916         this_arg_conv.inner = untag_ptr(this_arg);
60917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60919         this_arg_conv.is_owned = false;
60920         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
60921         uint64_t ret_ref = 0;
60922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60924         return ret_ref;
60925 }
60926
60927 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
60928         LDKHTLCDescriptor this_arg_conv;
60929         this_arg_conv.inner = untag_ptr(this_arg);
60930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60932         this_arg_conv.is_owned = false;
60933         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
60934         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
60935         return tag_ptr(ret_ref, true);
60936 }
60937
60938 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
60939         LDKHTLCDescriptor this_arg_conv;
60940         this_arg_conv.inner = untag_ptr(this_arg);
60941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60943         this_arg_conv.is_owned = false;
60944         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
60945         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
60946         return tag_ptr(ret_ref, true);
60947 }
60948
60949 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
60950         LDKHTLCDescriptor this_arg_conv;
60951         this_arg_conv.inner = untag_ptr(this_arg);
60952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60954         this_arg_conv.is_owned = false;
60955         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
60956         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
60957         return tag_ptr(ret_ref, true);
60958 }
60959
60960 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
60961         LDKHTLCDescriptor this_arg_conv;
60962         this_arg_conv.inner = untag_ptr(this_arg);
60963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60965         this_arg_conv.is_owned = false;
60966         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
60967         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60968         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60969         CVec_u8Z_free(ret_var);
60970         return ret_arr;
60971 }
60972
60973 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) {
60974         LDKHTLCDescriptor this_arg_conv;
60975         this_arg_conv.inner = untag_ptr(this_arg);
60976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60978         this_arg_conv.is_owned = false;
60979         LDKSignature signature_ref;
60980         CHECK(signature->arr_len == 64);
60981         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
60982         LDKu8slice witness_script_ref;
60983         witness_script_ref.datalen = witness_script->arr_len;
60984         witness_script_ref.data = witness_script->elems;
60985         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
60986         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60987         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60988         Witness_free(ret_var);
60989         FREE(witness_script);
60990         return ret_arr;
60991 }
60992
60993 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
60994         LDKHTLCDescriptor this_arg_conv;
60995         this_arg_conv.inner = untag_ptr(this_arg);
60996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60998         this_arg_conv.is_owned = false;
60999         void* signer_provider_ptr = untag_ptr(signer_provider);
61000         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
61001         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
61002         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
61003         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
61004         return tag_ptr(ret_ret, true);
61005 }
61006
61007 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
61008         if (!ptr_is_owned(this_ptr)) return;
61009         void* this_ptr_ptr = untag_ptr(this_ptr);
61010         CHECK_ACCESS(this_ptr_ptr);
61011         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
61012         FREE(untag_ptr(this_ptr));
61013         BumpTransactionEvent_free(this_ptr_conv);
61014 }
61015
61016 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
61017         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
61018         *ret_copy = BumpTransactionEvent_clone(arg);
61019         uint64_t ret_ref = tag_ptr(ret_copy, true);
61020         return ret_ref;
61021 }
61022 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
61023         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
61024         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
61025         return ret_conv;
61026 }
61027
61028 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
61029         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
61030         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
61031         *ret_copy = BumpTransactionEvent_clone(orig_conv);
61032         uint64_t ret_ref = tag_ptr(ret_copy, true);
61033         return ret_ref;
61034 }
61035
61036 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) {
61037         LDKThirtyTwoBytes claim_id_ref;
61038         CHECK(claim_id->arr_len == 32);
61039         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
61040         LDKTransaction commitment_tx_ref;
61041         commitment_tx_ref.datalen = commitment_tx->arr_len;
61042         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
61043         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
61044         commitment_tx_ref.data_is_owned = true;
61045         LDKAnchorDescriptor anchor_descriptor_conv;
61046         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
61047         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
61048         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
61049         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
61050         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
61051         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
61052         if (pending_htlcs_constr.datalen > 0)
61053                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
61054         else
61055                 pending_htlcs_constr.data = NULL;
61056         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
61057         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
61058                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
61059                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
61060                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
61061                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
61062                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
61063                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
61064                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
61065         }
61066         FREE(pending_htlcs);
61067         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
61068         *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);
61069         uint64_t ret_ref = tag_ptr(ret_copy, true);
61070         return ret_ref;
61071 }
61072
61073 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) {
61074         LDKThirtyTwoBytes claim_id_ref;
61075         CHECK(claim_id->arr_len == 32);
61076         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
61077         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
61078         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
61079         if (htlc_descriptors_constr.datalen > 0)
61080                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
61081         else
61082                 htlc_descriptors_constr.data = NULL;
61083         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
61084         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
61085                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
61086                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
61087                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
61088                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
61089                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
61090                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
61091                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
61092         }
61093         FREE(htlc_descriptors);
61094         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
61095         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
61096         uint64_t ret_ref = tag_ptr(ret_copy, true);
61097         return ret_ref;
61098 }
61099
61100 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
61101         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
61102         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
61103         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
61104         return ret_conv;
61105 }
61106
61107 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
61108         LDKInput this_obj_conv;
61109         this_obj_conv.inner = untag_ptr(this_obj);
61110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61112         Input_free(this_obj_conv);
61113 }
61114
61115 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
61116         LDKInput this_ptr_conv;
61117         this_ptr_conv.inner = untag_ptr(this_ptr);
61118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61120         this_ptr_conv.is_owned = false;
61121         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
61122         uint64_t ret_ref = 0;
61123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61125         return ret_ref;
61126 }
61127
61128 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
61129         LDKInput this_ptr_conv;
61130         this_ptr_conv.inner = untag_ptr(this_ptr);
61131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61133         this_ptr_conv.is_owned = false;
61134         LDKOutPoint val_conv;
61135         val_conv.inner = untag_ptr(val);
61136         val_conv.is_owned = ptr_is_owned(val);
61137         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61138         val_conv = OutPoint_clone(&val_conv);
61139         Input_set_outpoint(&this_ptr_conv, val_conv);
61140 }
61141
61142 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
61143         LDKInput this_ptr_conv;
61144         this_ptr_conv.inner = untag_ptr(this_ptr);
61145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61147         this_ptr_conv.is_owned = false;
61148         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61149         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
61150         return tag_ptr(ret_ref, true);
61151 }
61152
61153 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
61154         LDKInput this_ptr_conv;
61155         this_ptr_conv.inner = untag_ptr(this_ptr);
61156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61158         this_ptr_conv.is_owned = false;
61159         void* val_ptr = untag_ptr(val);
61160         CHECK_ACCESS(val_ptr);
61161         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61162         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61163         Input_set_previous_utxo(&this_ptr_conv, val_conv);
61164 }
61165
61166 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
61167         LDKInput this_ptr_conv;
61168         this_ptr_conv.inner = untag_ptr(this_ptr);
61169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61171         this_ptr_conv.is_owned = false;
61172         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
61173         return ret_conv;
61174 }
61175
61176 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
61177         LDKInput this_ptr_conv;
61178         this_ptr_conv.inner = untag_ptr(this_ptr);
61179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61181         this_ptr_conv.is_owned = false;
61182         Input_set_satisfaction_weight(&this_ptr_conv, val);
61183 }
61184
61185 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) {
61186         LDKOutPoint outpoint_arg_conv;
61187         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61188         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61189         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61190         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61191         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
61192         CHECK_ACCESS(previous_utxo_arg_ptr);
61193         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
61194         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
61195         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
61196         uint64_t ret_ref = 0;
61197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61199         return ret_ref;
61200 }
61201
61202 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
61203         LDKInput ret_var = Input_clone(arg);
61204         uint64_t ret_ref = 0;
61205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61207         return ret_ref;
61208 }
61209 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
61210         LDKInput arg_conv;
61211         arg_conv.inner = untag_ptr(arg);
61212         arg_conv.is_owned = ptr_is_owned(arg);
61213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61214         arg_conv.is_owned = false;
61215         int64_t ret_conv = Input_clone_ptr(&arg_conv);
61216         return ret_conv;
61217 }
61218
61219 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
61220         LDKInput orig_conv;
61221         orig_conv.inner = untag_ptr(orig);
61222         orig_conv.is_owned = ptr_is_owned(orig);
61223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61224         orig_conv.is_owned = false;
61225         LDKInput ret_var = Input_clone(&orig_conv);
61226         uint64_t ret_ref = 0;
61227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61229         return ret_ref;
61230 }
61231
61232 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
61233         LDKInput o_conv;
61234         o_conv.inner = untag_ptr(o);
61235         o_conv.is_owned = ptr_is_owned(o);
61236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61237         o_conv.is_owned = false;
61238         int64_t ret_conv = Input_hash(&o_conv);
61239         return ret_conv;
61240 }
61241
61242 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
61243         LDKInput a_conv;
61244         a_conv.inner = untag_ptr(a);
61245         a_conv.is_owned = ptr_is_owned(a);
61246         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61247         a_conv.is_owned = false;
61248         LDKInput b_conv;
61249         b_conv.inner = untag_ptr(b);
61250         b_conv.is_owned = ptr_is_owned(b);
61251         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61252         b_conv.is_owned = false;
61253         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
61254         return ret_conv;
61255 }
61256
61257 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
61258         LDKUtxo this_obj_conv;
61259         this_obj_conv.inner = untag_ptr(this_obj);
61260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61262         Utxo_free(this_obj_conv);
61263 }
61264
61265 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
61266         LDKUtxo this_ptr_conv;
61267         this_ptr_conv.inner = untag_ptr(this_ptr);
61268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61270         this_ptr_conv.is_owned = false;
61271         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
61272         uint64_t ret_ref = 0;
61273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61275         return ret_ref;
61276 }
61277
61278 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
61279         LDKUtxo this_ptr_conv;
61280         this_ptr_conv.inner = untag_ptr(this_ptr);
61281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61283         this_ptr_conv.is_owned = false;
61284         LDKOutPoint val_conv;
61285         val_conv.inner = untag_ptr(val);
61286         val_conv.is_owned = ptr_is_owned(val);
61287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61288         val_conv = OutPoint_clone(&val_conv);
61289         Utxo_set_outpoint(&this_ptr_conv, val_conv);
61290 }
61291
61292 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
61293         LDKUtxo this_ptr_conv;
61294         this_ptr_conv.inner = untag_ptr(this_ptr);
61295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61297         this_ptr_conv.is_owned = false;
61298         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61299         *ret_ref = Utxo_get_output(&this_ptr_conv);
61300         return tag_ptr(ret_ref, true);
61301 }
61302
61303 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
61304         LDKUtxo this_ptr_conv;
61305         this_ptr_conv.inner = untag_ptr(this_ptr);
61306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61308         this_ptr_conv.is_owned = false;
61309         void* val_ptr = untag_ptr(val);
61310         CHECK_ACCESS(val_ptr);
61311         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61312         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61313         Utxo_set_output(&this_ptr_conv, val_conv);
61314 }
61315
61316 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
61317         LDKUtxo this_ptr_conv;
61318         this_ptr_conv.inner = untag_ptr(this_ptr);
61319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61321         this_ptr_conv.is_owned = false;
61322         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
61323         return ret_conv;
61324 }
61325
61326 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
61327         LDKUtxo this_ptr_conv;
61328         this_ptr_conv.inner = untag_ptr(this_ptr);
61329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61331         this_ptr_conv.is_owned = false;
61332         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
61333 }
61334
61335 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
61336         LDKOutPoint outpoint_arg_conv;
61337         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61338         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61339         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61340         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61341         void* output_arg_ptr = untag_ptr(output_arg);
61342         CHECK_ACCESS(output_arg_ptr);
61343         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
61344         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
61345         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
61346         uint64_t ret_ref = 0;
61347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61349         return ret_ref;
61350 }
61351
61352 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
61353         LDKUtxo ret_var = Utxo_clone(arg);
61354         uint64_t ret_ref = 0;
61355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61357         return ret_ref;
61358 }
61359 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
61360         LDKUtxo arg_conv;
61361         arg_conv.inner = untag_ptr(arg);
61362         arg_conv.is_owned = ptr_is_owned(arg);
61363         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61364         arg_conv.is_owned = false;
61365         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
61366         return ret_conv;
61367 }
61368
61369 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
61370         LDKUtxo orig_conv;
61371         orig_conv.inner = untag_ptr(orig);
61372         orig_conv.is_owned = ptr_is_owned(orig);
61373         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61374         orig_conv.is_owned = false;
61375         LDKUtxo ret_var = Utxo_clone(&orig_conv);
61376         uint64_t ret_ref = 0;
61377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61379         return ret_ref;
61380 }
61381
61382 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
61383         LDKUtxo o_conv;
61384         o_conv.inner = untag_ptr(o);
61385         o_conv.is_owned = ptr_is_owned(o);
61386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61387         o_conv.is_owned = false;
61388         int64_t ret_conv = Utxo_hash(&o_conv);
61389         return ret_conv;
61390 }
61391
61392 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
61393         LDKUtxo a_conv;
61394         a_conv.inner = untag_ptr(a);
61395         a_conv.is_owned = ptr_is_owned(a);
61396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61397         a_conv.is_owned = false;
61398         LDKUtxo b_conv;
61399         b_conv.inner = untag_ptr(b);
61400         b_conv.is_owned = ptr_is_owned(b);
61401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61402         b_conv.is_owned = false;
61403         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
61404         return ret_conv;
61405 }
61406
61407 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
61408         LDKOutPoint outpoint_conv;
61409         outpoint_conv.inner = untag_ptr(outpoint);
61410         outpoint_conv.is_owned = ptr_is_owned(outpoint);
61411         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
61412         outpoint_conv = OutPoint_clone(&outpoint_conv);
61413         uint8_t pubkey_hash_arr[20];
61414         CHECK(pubkey_hash->arr_len == 20);
61415         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
61416         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
61417         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
61418         uint64_t ret_ref = 0;
61419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61421         return ret_ref;
61422 }
61423
61424 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
61425         LDKCoinSelection this_obj_conv;
61426         this_obj_conv.inner = untag_ptr(this_obj);
61427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61429         CoinSelection_free(this_obj_conv);
61430 }
61431
61432 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
61433         LDKCoinSelection this_ptr_conv;
61434         this_ptr_conv.inner = untag_ptr(this_ptr);
61435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61437         this_ptr_conv.is_owned = false;
61438         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
61439         uint64_tArray ret_arr = NULL;
61440         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
61441         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
61442         for (size_t g = 0; g < ret_var.datalen; g++) {
61443                 LDKUtxo ret_conv_6_var = ret_var.data[g];
61444                 uint64_t ret_conv_6_ref = 0;
61445                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
61446                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
61447                 ret_arr_ptr[g] = ret_conv_6_ref;
61448         }
61449         
61450         FREE(ret_var.data);
61451         return ret_arr;
61452 }
61453
61454 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
61455         LDKCoinSelection this_ptr_conv;
61456         this_ptr_conv.inner = untag_ptr(this_ptr);
61457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61459         this_ptr_conv.is_owned = false;
61460         LDKCVec_UtxoZ val_constr;
61461         val_constr.datalen = val->arr_len;
61462         if (val_constr.datalen > 0)
61463                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
61464         else
61465                 val_constr.data = NULL;
61466         uint64_t* val_vals = val->elems;
61467         for (size_t g = 0; g < val_constr.datalen; g++) {
61468                 uint64_t val_conv_6 = val_vals[g];
61469                 LDKUtxo val_conv_6_conv;
61470                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
61471                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
61472                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
61473                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
61474                 val_constr.data[g] = val_conv_6_conv;
61475         }
61476         FREE(val);
61477         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
61478 }
61479
61480 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
61481         LDKCoinSelection this_ptr_conv;
61482         this_ptr_conv.inner = untag_ptr(this_ptr);
61483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61485         this_ptr_conv.is_owned = false;
61486         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
61487         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
61488         uint64_t ret_ref = tag_ptr(ret_copy, true);
61489         return ret_ref;
61490 }
61491
61492 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
61493         LDKCoinSelection this_ptr_conv;
61494         this_ptr_conv.inner = untag_ptr(this_ptr);
61495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61497         this_ptr_conv.is_owned = false;
61498         void* val_ptr = untag_ptr(val);
61499         CHECK_ACCESS(val_ptr);
61500         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
61501         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
61502         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
61503 }
61504
61505 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
61506         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
61507         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
61508         if (confirmed_utxos_arg_constr.datalen > 0)
61509                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
61510         else
61511                 confirmed_utxos_arg_constr.data = NULL;
61512         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
61513         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
61514                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
61515                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
61516                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
61517                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
61518                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
61519                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
61520                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
61521         }
61522         FREE(confirmed_utxos_arg);
61523         void* change_output_arg_ptr = untag_ptr(change_output_arg);
61524         CHECK_ACCESS(change_output_arg_ptr);
61525         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
61526         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
61527         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
61528         uint64_t ret_ref = 0;
61529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61531         return ret_ref;
61532 }
61533
61534 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
61535         LDKCoinSelection ret_var = CoinSelection_clone(arg);
61536         uint64_t ret_ref = 0;
61537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61539         return ret_ref;
61540 }
61541 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
61542         LDKCoinSelection arg_conv;
61543         arg_conv.inner = untag_ptr(arg);
61544         arg_conv.is_owned = ptr_is_owned(arg);
61545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61546         arg_conv.is_owned = false;
61547         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
61548         return ret_conv;
61549 }
61550
61551 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
61552         LDKCoinSelection orig_conv;
61553         orig_conv.inner = untag_ptr(orig);
61554         orig_conv.is_owned = ptr_is_owned(orig);
61555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61556         orig_conv.is_owned = false;
61557         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
61558         uint64_t ret_ref = 0;
61559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61561         return ret_ref;
61562 }
61563
61564 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
61565         if (!ptr_is_owned(this_ptr)) return;
61566         void* this_ptr_ptr = untag_ptr(this_ptr);
61567         CHECK_ACCESS(this_ptr_ptr);
61568         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
61569         FREE(untag_ptr(this_ptr));
61570         CoinSelectionSource_free(this_ptr_conv);
61571 }
61572
61573 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
61574         if (!ptr_is_owned(this_ptr)) return;
61575         void* this_ptr_ptr = untag_ptr(this_ptr);
61576         CHECK_ACCESS(this_ptr_ptr);
61577         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
61578         FREE(untag_ptr(this_ptr));
61579         WalletSource_free(this_ptr_conv);
61580 }
61581
61582 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
61583         LDKWallet this_obj_conv;
61584         this_obj_conv.inner = untag_ptr(this_obj);
61585         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61587         Wallet_free(this_obj_conv);
61588 }
61589
61590 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
61591         void* source_ptr = untag_ptr(source);
61592         CHECK_ACCESS(source_ptr);
61593         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
61594         if (source_conv.free == LDKWalletSource_JCalls_free) {
61595                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61596                 LDKWalletSource_JCalls_cloned(&source_conv);
61597         }
61598         void* logger_ptr = untag_ptr(logger);
61599         CHECK_ACCESS(logger_ptr);
61600         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61601         if (logger_conv.free == LDKLogger_JCalls_free) {
61602                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61603                 LDKLogger_JCalls_cloned(&logger_conv);
61604         }
61605         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
61606         uint64_t ret_ref = 0;
61607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61609         return ret_ref;
61610 }
61611
61612 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
61613         LDKWallet this_arg_conv;
61614         this_arg_conv.inner = untag_ptr(this_arg);
61615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61617         this_arg_conv.is_owned = false;
61618         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
61619         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
61620         return tag_ptr(ret_ret, true);
61621 }
61622
61623 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
61624         LDKBumpTransactionEventHandler this_obj_conv;
61625         this_obj_conv.inner = untag_ptr(this_obj);
61626         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61628         BumpTransactionEventHandler_free(this_obj_conv);
61629 }
61630
61631 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) {
61632         void* broadcaster_ptr = untag_ptr(broadcaster);
61633         CHECK_ACCESS(broadcaster_ptr);
61634         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
61635         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
61636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61637                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
61638         }
61639         void* utxo_source_ptr = untag_ptr(utxo_source);
61640         CHECK_ACCESS(utxo_source_ptr);
61641         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
61642         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
61643                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61644                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
61645         }
61646         void* signer_provider_ptr = untag_ptr(signer_provider);
61647         CHECK_ACCESS(signer_provider_ptr);
61648         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
61649         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
61650                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61651                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
61652         }
61653         void* logger_ptr = untag_ptr(logger);
61654         CHECK_ACCESS(logger_ptr);
61655         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61656         if (logger_conv.free == LDKLogger_JCalls_free) {
61657                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61658                 LDKLogger_JCalls_cloned(&logger_conv);
61659         }
61660         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
61661         uint64_t ret_ref = 0;
61662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61664         return ret_ref;
61665 }
61666
61667 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
61668         LDKBumpTransactionEventHandler this_arg_conv;
61669         this_arg_conv.inner = untag_ptr(this_arg);
61670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61672         this_arg_conv.is_owned = false;
61673         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
61674         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
61675 }
61676
61677 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
61678         if (!ptr_is_owned(this_ptr)) return;
61679         void* this_ptr_ptr = untag_ptr(this_ptr);
61680         CHECK_ACCESS(this_ptr_ptr);
61681         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
61682         FREE(untag_ptr(this_ptr));
61683         GossipSync_free(this_ptr_conv);
61684 }
61685
61686 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
61687         LDKP2PGossipSync a_conv;
61688         a_conv.inner = untag_ptr(a);
61689         a_conv.is_owned = ptr_is_owned(a);
61690         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61691         a_conv.is_owned = false;
61692         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
61693         *ret_copy = GossipSync_p2_p(&a_conv);
61694         uint64_t ret_ref = tag_ptr(ret_copy, true);
61695         return ret_ref;
61696 }
61697
61698 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
61699         LDKRapidGossipSync a_conv;
61700         a_conv.inner = untag_ptr(a);
61701         a_conv.is_owned = ptr_is_owned(a);
61702         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61703         a_conv.is_owned = false;
61704         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
61705         *ret_copy = GossipSync_rapid(&a_conv);
61706         uint64_t ret_ref = tag_ptr(ret_copy, true);
61707         return ret_ref;
61708 }
61709
61710 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
61711         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
61712         *ret_copy = GossipSync_none();
61713         uint64_t ret_ref = tag_ptr(ret_copy, true);
61714         return ret_ref;
61715 }
61716
61717 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
61718         LDKRapidGossipSync this_obj_conv;
61719         this_obj_conv.inner = untag_ptr(this_obj);
61720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61722         RapidGossipSync_free(this_obj_conv);
61723 }
61724
61725 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
61726         LDKNetworkGraph network_graph_conv;
61727         network_graph_conv.inner = untag_ptr(network_graph);
61728         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61729         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61730         network_graph_conv.is_owned = false;
61731         void* logger_ptr = untag_ptr(logger);
61732         CHECK_ACCESS(logger_ptr);
61733         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61734         if (logger_conv.free == LDKLogger_JCalls_free) {
61735                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61736                 LDKLogger_JCalls_cloned(&logger_conv);
61737         }
61738         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
61739         uint64_t ret_ref = 0;
61740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61742         return ret_ref;
61743 }
61744
61745 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) {
61746         LDKRapidGossipSync this_arg_conv;
61747         this_arg_conv.inner = untag_ptr(this_arg);
61748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61750         this_arg_conv.is_owned = false;
61751         LDKu8slice update_data_ref;
61752         update_data_ref.datalen = update_data->arr_len;
61753         update_data_ref.data = update_data->elems;
61754         void* current_time_unix_ptr = untag_ptr(current_time_unix);
61755         CHECK_ACCESS(current_time_unix_ptr);
61756         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
61757         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
61758         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
61759         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
61760         FREE(update_data);
61761         return tag_ptr(ret_conv, true);
61762 }
61763
61764 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
61765         LDKRapidGossipSync this_arg_conv;
61766         this_arg_conv.inner = untag_ptr(this_arg);
61767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61769         this_arg_conv.is_owned = false;
61770         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
61771         return ret_conv;
61772 }
61773
61774 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
61775         if (!ptr_is_owned(this_ptr)) return;
61776         void* this_ptr_ptr = untag_ptr(this_ptr);
61777         CHECK_ACCESS(this_ptr_ptr);
61778         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
61779         FREE(untag_ptr(this_ptr));
61780         GraphSyncError_free(this_ptr_conv);
61781 }
61782
61783 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
61784         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
61785         *ret_copy = GraphSyncError_clone(arg);
61786         uint64_t ret_ref = tag_ptr(ret_copy, true);
61787         return ret_ref;
61788 }
61789 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
61790         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
61791         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
61792         return ret_conv;
61793 }
61794
61795 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
61796         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
61797         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
61798         *ret_copy = GraphSyncError_clone(orig_conv);
61799         uint64_t ret_ref = tag_ptr(ret_copy, true);
61800         return ret_ref;
61801 }
61802
61803 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
61804         void* a_ptr = untag_ptr(a);
61805         CHECK_ACCESS(a_ptr);
61806         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
61807         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
61808         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
61809         *ret_copy = GraphSyncError_decode_error(a_conv);
61810         uint64_t ret_ref = tag_ptr(ret_copy, true);
61811         return ret_ref;
61812 }
61813
61814 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
61815         LDKLightningError a_conv;
61816         a_conv.inner = untag_ptr(a);
61817         a_conv.is_owned = ptr_is_owned(a);
61818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61819         a_conv = LightningError_clone(&a_conv);
61820         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
61821         *ret_copy = GraphSyncError_lightning_error(a_conv);
61822         uint64_t ret_ref = tag_ptr(ret_copy, true);
61823         return ret_ref;
61824 }
61825
61826 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
61827         if (!ptr_is_owned(this_ptr)) return;
61828         void* this_ptr_ptr = untag_ptr(this_ptr);
61829         CHECK_ACCESS(this_ptr_ptr);
61830         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
61831         FREE(untag_ptr(this_ptr));
61832         Bolt11ParseError_free(this_ptr_conv);
61833 }
61834
61835 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
61836         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61837         *ret_copy = Bolt11ParseError_clone(arg);
61838         uint64_t ret_ref = tag_ptr(ret_copy, true);
61839         return ret_ref;
61840 }
61841 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
61842         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
61843         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
61844         return ret_conv;
61845 }
61846
61847 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
61848         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
61849         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61850         *ret_copy = Bolt11ParseError_clone(orig_conv);
61851         uint64_t ret_ref = tag_ptr(ret_copy, true);
61852         return ret_ref;
61853 }
61854
61855 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
61856         void* a_ptr = untag_ptr(a);
61857         CHECK_ACCESS(a_ptr);
61858         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
61859         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
61860         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61861         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
61862         uint64_t ret_ref = tag_ptr(ret_copy, true);
61863         return ret_ref;
61864 }
61865
61866 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
61867         
61868         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61869         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
61870         uint64_t ret_ref = tag_ptr(ret_copy, true);
61871         return ret_ref;
61872 }
61873
61874 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
61875         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
61876         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61877         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
61878         uint64_t ret_ref = tag_ptr(ret_copy, true);
61879         return ret_ref;
61880 }
61881
61882 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
61883         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61884         *ret_copy = Bolt11ParseError_bad_prefix();
61885         uint64_t ret_ref = tag_ptr(ret_copy, true);
61886         return ret_ref;
61887 }
61888
61889 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
61890         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61891         *ret_copy = Bolt11ParseError_unknown_currency();
61892         uint64_t ret_ref = tag_ptr(ret_copy, true);
61893         return ret_ref;
61894 }
61895
61896 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
61897         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61898         *ret_copy = Bolt11ParseError_unknown_si_prefix();
61899         uint64_t ret_ref = tag_ptr(ret_copy, true);
61900         return ret_ref;
61901 }
61902
61903 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
61904         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61905         *ret_copy = Bolt11ParseError_malformed_hrp();
61906         uint64_t ret_ref = tag_ptr(ret_copy, true);
61907         return ret_ref;
61908 }
61909
61910 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
61911         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61912         *ret_copy = Bolt11ParseError_too_short_data_part();
61913         uint64_t ret_ref = tag_ptr(ret_copy, true);
61914         return ret_ref;
61915 }
61916
61917 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
61918         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61919         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
61920         uint64_t ret_ref = tag_ptr(ret_copy, true);
61921         return ret_ref;
61922 }
61923
61924 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
61925         
61926         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61927         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
61928         uint64_t ret_ref = tag_ptr(ret_copy, true);
61929         return ret_ref;
61930 }
61931
61932 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
61933         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61934         *ret_copy = Bolt11ParseError_padding_error();
61935         uint64_t ret_ref = tag_ptr(ret_copy, true);
61936         return ret_ref;
61937 }
61938
61939 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
61940         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61941         *ret_copy = Bolt11ParseError_integer_overflow_error();
61942         uint64_t ret_ref = tag_ptr(ret_copy, true);
61943         return ret_ref;
61944 }
61945
61946 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
61947         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61948         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
61949         uint64_t ret_ref = tag_ptr(ret_copy, true);
61950         return ret_ref;
61951 }
61952
61953 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
61954         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61955         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
61956         uint64_t ret_ref = tag_ptr(ret_copy, true);
61957         return ret_ref;
61958 }
61959
61960 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
61961         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61962         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
61963         uint64_t ret_ref = tag_ptr(ret_copy, true);
61964         return ret_ref;
61965 }
61966
61967 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
61968         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61969         *ret_copy = Bolt11ParseError_invalid_recovery_id();
61970         uint64_t ret_ref = tag_ptr(ret_copy, true);
61971         return ret_ref;
61972 }
61973
61974 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
61975         LDKStr a_conv = str_ref_to_owned_c(a);
61976         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61977         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
61978         uint64_t ret_ref = tag_ptr(ret_copy, true);
61979         return ret_ref;
61980 }
61981
61982 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
61983         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61984         *ret_copy = Bolt11ParseError_skip();
61985         uint64_t ret_ref = tag_ptr(ret_copy, true);
61986         return ret_ref;
61987 }
61988
61989 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
61990         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
61991         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
61992         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
61993         return ret_conv;
61994 }
61995
61996 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
61997         if (!ptr_is_owned(this_ptr)) return;
61998         void* this_ptr_ptr = untag_ptr(this_ptr);
61999         CHECK_ACCESS(this_ptr_ptr);
62000         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
62001         FREE(untag_ptr(this_ptr));
62002         ParseOrSemanticError_free(this_ptr_conv);
62003 }
62004
62005 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
62006         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
62007         *ret_copy = ParseOrSemanticError_clone(arg);
62008         uint64_t ret_ref = tag_ptr(ret_copy, true);
62009         return ret_ref;
62010 }
62011 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
62012         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
62013         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
62014         return ret_conv;
62015 }
62016
62017 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
62018         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
62019         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
62020         *ret_copy = ParseOrSemanticError_clone(orig_conv);
62021         uint64_t ret_ref = tag_ptr(ret_copy, true);
62022         return ret_ref;
62023 }
62024
62025 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
62026         void* a_ptr = untag_ptr(a);
62027         CHECK_ACCESS(a_ptr);
62028         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
62029         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
62030         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
62031         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
62032         uint64_t ret_ref = tag_ptr(ret_copy, true);
62033         return ret_ref;
62034 }
62035
62036 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
62037         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
62038         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
62039         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
62040         uint64_t ret_ref = tag_ptr(ret_copy, true);
62041         return ret_ref;
62042 }
62043
62044 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
62045         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
62046         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
62047         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
62048         return ret_conv;
62049 }
62050
62051 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
62052         LDKBolt11Invoice this_obj_conv;
62053         this_obj_conv.inner = untag_ptr(this_obj);
62054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62056         Bolt11Invoice_free(this_obj_conv);
62057 }
62058
62059 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
62060         LDKBolt11Invoice a_conv;
62061         a_conv.inner = untag_ptr(a);
62062         a_conv.is_owned = ptr_is_owned(a);
62063         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62064         a_conv.is_owned = false;
62065         LDKBolt11Invoice b_conv;
62066         b_conv.inner = untag_ptr(b);
62067         b_conv.is_owned = ptr_is_owned(b);
62068         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62069         b_conv.is_owned = false;
62070         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
62071         return ret_conv;
62072 }
62073
62074 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
62075         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
62076         uint64_t ret_ref = 0;
62077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62079         return ret_ref;
62080 }
62081 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
62082         LDKBolt11Invoice arg_conv;
62083         arg_conv.inner = untag_ptr(arg);
62084         arg_conv.is_owned = ptr_is_owned(arg);
62085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62086         arg_conv.is_owned = false;
62087         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
62088         return ret_conv;
62089 }
62090
62091 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
62092         LDKBolt11Invoice orig_conv;
62093         orig_conv.inner = untag_ptr(orig);
62094         orig_conv.is_owned = ptr_is_owned(orig);
62095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62096         orig_conv.is_owned = false;
62097         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
62098         uint64_t ret_ref = 0;
62099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62101         return ret_ref;
62102 }
62103
62104 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
62105         LDKBolt11Invoice o_conv;
62106         o_conv.inner = untag_ptr(o);
62107         o_conv.is_owned = ptr_is_owned(o);
62108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62109         o_conv.is_owned = false;
62110         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
62111         return ret_conv;
62112 }
62113
62114 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
62115         LDKSignedRawBolt11Invoice this_obj_conv;
62116         this_obj_conv.inner = untag_ptr(this_obj);
62117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62119         SignedRawBolt11Invoice_free(this_obj_conv);
62120 }
62121
62122 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
62123         LDKSignedRawBolt11Invoice a_conv;
62124         a_conv.inner = untag_ptr(a);
62125         a_conv.is_owned = ptr_is_owned(a);
62126         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62127         a_conv.is_owned = false;
62128         LDKSignedRawBolt11Invoice b_conv;
62129         b_conv.inner = untag_ptr(b);
62130         b_conv.is_owned = ptr_is_owned(b);
62131         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62132         b_conv.is_owned = false;
62133         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
62134         return ret_conv;
62135 }
62136
62137 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
62138         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
62139         uint64_t ret_ref = 0;
62140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62142         return ret_ref;
62143 }
62144 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
62145         LDKSignedRawBolt11Invoice arg_conv;
62146         arg_conv.inner = untag_ptr(arg);
62147         arg_conv.is_owned = ptr_is_owned(arg);
62148         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62149         arg_conv.is_owned = false;
62150         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
62151         return ret_conv;
62152 }
62153
62154 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
62155         LDKSignedRawBolt11Invoice orig_conv;
62156         orig_conv.inner = untag_ptr(orig);
62157         orig_conv.is_owned = ptr_is_owned(orig);
62158         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62159         orig_conv.is_owned = false;
62160         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
62161         uint64_t ret_ref = 0;
62162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62164         return ret_ref;
62165 }
62166
62167 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
62168         LDKSignedRawBolt11Invoice o_conv;
62169         o_conv.inner = untag_ptr(o);
62170         o_conv.is_owned = ptr_is_owned(o);
62171         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62172         o_conv.is_owned = false;
62173         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
62174         return ret_conv;
62175 }
62176
62177 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
62178         LDKRawBolt11Invoice this_obj_conv;
62179         this_obj_conv.inner = untag_ptr(this_obj);
62180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62182         RawBolt11Invoice_free(this_obj_conv);
62183 }
62184
62185 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
62186         LDKRawBolt11Invoice this_ptr_conv;
62187         this_ptr_conv.inner = untag_ptr(this_ptr);
62188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62190         this_ptr_conv.is_owned = false;
62191         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
62192         uint64_t ret_ref = 0;
62193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62195         return ret_ref;
62196 }
62197
62198 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
62199         LDKRawBolt11Invoice this_ptr_conv;
62200         this_ptr_conv.inner = untag_ptr(this_ptr);
62201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62203         this_ptr_conv.is_owned = false;
62204         LDKRawDataPart val_conv;
62205         val_conv.inner = untag_ptr(val);
62206         val_conv.is_owned = ptr_is_owned(val);
62207         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62208         val_conv = RawDataPart_clone(&val_conv);
62209         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
62210 }
62211
62212 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
62213         LDKRawBolt11Invoice a_conv;
62214         a_conv.inner = untag_ptr(a);
62215         a_conv.is_owned = ptr_is_owned(a);
62216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62217         a_conv.is_owned = false;
62218         LDKRawBolt11Invoice b_conv;
62219         b_conv.inner = untag_ptr(b);
62220         b_conv.is_owned = ptr_is_owned(b);
62221         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62222         b_conv.is_owned = false;
62223         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
62224         return ret_conv;
62225 }
62226
62227 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
62228         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
62229         uint64_t ret_ref = 0;
62230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62232         return ret_ref;
62233 }
62234 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
62235         LDKRawBolt11Invoice arg_conv;
62236         arg_conv.inner = untag_ptr(arg);
62237         arg_conv.is_owned = ptr_is_owned(arg);
62238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62239         arg_conv.is_owned = false;
62240         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
62241         return ret_conv;
62242 }
62243
62244 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
62245         LDKRawBolt11Invoice orig_conv;
62246         orig_conv.inner = untag_ptr(orig);
62247         orig_conv.is_owned = ptr_is_owned(orig);
62248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62249         orig_conv.is_owned = false;
62250         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
62251         uint64_t ret_ref = 0;
62252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62254         return ret_ref;
62255 }
62256
62257 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
62258         LDKRawBolt11Invoice o_conv;
62259         o_conv.inner = untag_ptr(o);
62260         o_conv.is_owned = ptr_is_owned(o);
62261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62262         o_conv.is_owned = false;
62263         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
62264         return ret_conv;
62265 }
62266
62267 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
62268         LDKRawDataPart this_obj_conv;
62269         this_obj_conv.inner = untag_ptr(this_obj);
62270         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62272         RawDataPart_free(this_obj_conv);
62273 }
62274
62275 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
62276         LDKRawDataPart this_ptr_conv;
62277         this_ptr_conv.inner = untag_ptr(this_ptr);
62278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62280         this_ptr_conv.is_owned = false;
62281         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
62282         uint64_t ret_ref = 0;
62283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62285         return ret_ref;
62286 }
62287
62288 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
62289         LDKRawDataPart this_ptr_conv;
62290         this_ptr_conv.inner = untag_ptr(this_ptr);
62291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62293         this_ptr_conv.is_owned = false;
62294         LDKPositiveTimestamp val_conv;
62295         val_conv.inner = untag_ptr(val);
62296         val_conv.is_owned = ptr_is_owned(val);
62297         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62298         val_conv = PositiveTimestamp_clone(&val_conv);
62299         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
62300 }
62301
62302 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
62303         LDKRawDataPart a_conv;
62304         a_conv.inner = untag_ptr(a);
62305         a_conv.is_owned = ptr_is_owned(a);
62306         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62307         a_conv.is_owned = false;
62308         LDKRawDataPart b_conv;
62309         b_conv.inner = untag_ptr(b);
62310         b_conv.is_owned = ptr_is_owned(b);
62311         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62312         b_conv.is_owned = false;
62313         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
62314         return ret_conv;
62315 }
62316
62317 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
62318         LDKRawDataPart ret_var = RawDataPart_clone(arg);
62319         uint64_t ret_ref = 0;
62320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62322         return ret_ref;
62323 }
62324 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
62325         LDKRawDataPart arg_conv;
62326         arg_conv.inner = untag_ptr(arg);
62327         arg_conv.is_owned = ptr_is_owned(arg);
62328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62329         arg_conv.is_owned = false;
62330         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
62331         return ret_conv;
62332 }
62333
62334 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
62335         LDKRawDataPart orig_conv;
62336         orig_conv.inner = untag_ptr(orig);
62337         orig_conv.is_owned = ptr_is_owned(orig);
62338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62339         orig_conv.is_owned = false;
62340         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
62341         uint64_t ret_ref = 0;
62342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62344         return ret_ref;
62345 }
62346
62347 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
62348         LDKRawDataPart o_conv;
62349         o_conv.inner = untag_ptr(o);
62350         o_conv.is_owned = ptr_is_owned(o);
62351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62352         o_conv.is_owned = false;
62353         int64_t ret_conv = RawDataPart_hash(&o_conv);
62354         return ret_conv;
62355 }
62356
62357 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
62358         LDKPositiveTimestamp this_obj_conv;
62359         this_obj_conv.inner = untag_ptr(this_obj);
62360         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62362         PositiveTimestamp_free(this_obj_conv);
62363 }
62364
62365 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
62366         LDKPositiveTimestamp a_conv;
62367         a_conv.inner = untag_ptr(a);
62368         a_conv.is_owned = ptr_is_owned(a);
62369         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62370         a_conv.is_owned = false;
62371         LDKPositiveTimestamp b_conv;
62372         b_conv.inner = untag_ptr(b);
62373         b_conv.is_owned = ptr_is_owned(b);
62374         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62375         b_conv.is_owned = false;
62376         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
62377         return ret_conv;
62378 }
62379
62380 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
62381         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
62382         uint64_t ret_ref = 0;
62383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62385         return ret_ref;
62386 }
62387 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
62388         LDKPositiveTimestamp arg_conv;
62389         arg_conv.inner = untag_ptr(arg);
62390         arg_conv.is_owned = ptr_is_owned(arg);
62391         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62392         arg_conv.is_owned = false;
62393         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
62394         return ret_conv;
62395 }
62396
62397 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
62398         LDKPositiveTimestamp orig_conv;
62399         orig_conv.inner = untag_ptr(orig);
62400         orig_conv.is_owned = ptr_is_owned(orig);
62401         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62402         orig_conv.is_owned = false;
62403         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
62404         uint64_t ret_ref = 0;
62405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62407         return ret_ref;
62408 }
62409
62410 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
62411         LDKPositiveTimestamp o_conv;
62412         o_conv.inner = untag_ptr(o);
62413         o_conv.is_owned = ptr_is_owned(o);
62414         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62415         o_conv.is_owned = false;
62416         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
62417         return ret_conv;
62418 }
62419
62420 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
62421         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
62422         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
62423         return ret_conv;
62424 }
62425
62426 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
62427         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
62428         return ret_conv;
62429 }
62430
62431 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
62432         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
62433         return ret_conv;
62434 }
62435
62436 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
62437         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
62438         return ret_conv;
62439 }
62440
62441 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
62442         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
62443         return ret_conv;
62444 }
62445
62446 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
62447         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
62448         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
62449         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
62450         return ret_conv;
62451 }
62452
62453 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
62454         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
62455         int64_t ret_conv = SiPrefix_hash(o_conv);
62456         return ret_conv;
62457 }
62458
62459 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
62460         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
62461         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
62462         return ret_conv;
62463 }
62464
62465 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
62466         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
62467         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
62468         return ret_conv;
62469 }
62470
62471 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
62472         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
62473         return ret_conv;
62474 }
62475
62476 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
62477         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
62478         return ret_conv;
62479 }
62480
62481 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
62482         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
62483         return ret_conv;
62484 }
62485
62486 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
62487         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
62488         return ret_conv;
62489 }
62490
62491 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
62492         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
62493         return ret_conv;
62494 }
62495
62496 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
62497         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
62498         int64_t ret_conv = Currency_hash(o_conv);
62499         return ret_conv;
62500 }
62501
62502 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
62503         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
62504         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
62505         jboolean ret_conv = Currency_eq(a_conv, b_conv);
62506         return ret_conv;
62507 }
62508
62509 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
62510         LDKSha256 this_obj_conv;
62511         this_obj_conv.inner = untag_ptr(this_obj);
62512         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62514         Sha256_free(this_obj_conv);
62515 }
62516
62517 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
62518         LDKSha256 ret_var = Sha256_clone(arg);
62519         uint64_t ret_ref = 0;
62520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62522         return ret_ref;
62523 }
62524 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
62525         LDKSha256 arg_conv;
62526         arg_conv.inner = untag_ptr(arg);
62527         arg_conv.is_owned = ptr_is_owned(arg);
62528         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62529         arg_conv.is_owned = false;
62530         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
62531         return ret_conv;
62532 }
62533
62534 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
62535         LDKSha256 orig_conv;
62536         orig_conv.inner = untag_ptr(orig);
62537         orig_conv.is_owned = ptr_is_owned(orig);
62538         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62539         orig_conv.is_owned = false;
62540         LDKSha256 ret_var = Sha256_clone(&orig_conv);
62541         uint64_t ret_ref = 0;
62542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62544         return ret_ref;
62545 }
62546
62547 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
62548         LDKSha256 o_conv;
62549         o_conv.inner = untag_ptr(o);
62550         o_conv.is_owned = ptr_is_owned(o);
62551         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62552         o_conv.is_owned = false;
62553         int64_t ret_conv = Sha256_hash(&o_conv);
62554         return ret_conv;
62555 }
62556
62557 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
62558         LDKSha256 a_conv;
62559         a_conv.inner = untag_ptr(a);
62560         a_conv.is_owned = ptr_is_owned(a);
62561         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62562         a_conv.is_owned = false;
62563         LDKSha256 b_conv;
62564         b_conv.inner = untag_ptr(b);
62565         b_conv.is_owned = ptr_is_owned(b);
62566         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62567         b_conv.is_owned = false;
62568         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
62569         return ret_conv;
62570 }
62571
62572 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
62573         uint8_t bytes_arr[32];
62574         CHECK(bytes->arr_len == 32);
62575         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
62576         uint8_t (*bytes_ref)[32] = &bytes_arr;
62577         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
62578         uint64_t ret_ref = 0;
62579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62581         return ret_ref;
62582 }
62583
62584 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
62585         LDKDescription this_obj_conv;
62586         this_obj_conv.inner = untag_ptr(this_obj);
62587         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62589         Description_free(this_obj_conv);
62590 }
62591
62592 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
62593         LDKDescription ret_var = Description_clone(arg);
62594         uint64_t ret_ref = 0;
62595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62597         return ret_ref;
62598 }
62599 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
62600         LDKDescription arg_conv;
62601         arg_conv.inner = untag_ptr(arg);
62602         arg_conv.is_owned = ptr_is_owned(arg);
62603         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62604         arg_conv.is_owned = false;
62605         int64_t ret_conv = Description_clone_ptr(&arg_conv);
62606         return ret_conv;
62607 }
62608
62609 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
62610         LDKDescription orig_conv;
62611         orig_conv.inner = untag_ptr(orig);
62612         orig_conv.is_owned = ptr_is_owned(orig);
62613         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62614         orig_conv.is_owned = false;
62615         LDKDescription ret_var = Description_clone(&orig_conv);
62616         uint64_t ret_ref = 0;
62617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62619         return ret_ref;
62620 }
62621
62622 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
62623         LDKDescription o_conv;
62624         o_conv.inner = untag_ptr(o);
62625         o_conv.is_owned = ptr_is_owned(o);
62626         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62627         o_conv.is_owned = false;
62628         int64_t ret_conv = Description_hash(&o_conv);
62629         return ret_conv;
62630 }
62631
62632 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
62633         LDKDescription a_conv;
62634         a_conv.inner = untag_ptr(a);
62635         a_conv.is_owned = ptr_is_owned(a);
62636         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62637         a_conv.is_owned = false;
62638         LDKDescription b_conv;
62639         b_conv.inner = untag_ptr(b);
62640         b_conv.is_owned = ptr_is_owned(b);
62641         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62642         b_conv.is_owned = false;
62643         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
62644         return ret_conv;
62645 }
62646
62647 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
62648         LDKPayeePubKey this_obj_conv;
62649         this_obj_conv.inner = untag_ptr(this_obj);
62650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62652         PayeePubKey_free(this_obj_conv);
62653 }
62654
62655 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
62656         LDKPayeePubKey this_ptr_conv;
62657         this_ptr_conv.inner = untag_ptr(this_ptr);
62658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62660         this_ptr_conv.is_owned = false;
62661         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62662         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
62663         return ret_arr;
62664 }
62665
62666 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
62667         LDKPayeePubKey this_ptr_conv;
62668         this_ptr_conv.inner = untag_ptr(this_ptr);
62669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62671         this_ptr_conv.is_owned = false;
62672         LDKPublicKey val_ref;
62673         CHECK(val->arr_len == 33);
62674         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
62675         PayeePubKey_set_a(&this_ptr_conv, val_ref);
62676 }
62677
62678 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
62679         LDKPublicKey a_arg_ref;
62680         CHECK(a_arg->arr_len == 33);
62681         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
62682         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
62683         uint64_t ret_ref = 0;
62684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62686         return ret_ref;
62687 }
62688
62689 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
62690         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
62691         uint64_t ret_ref = 0;
62692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62694         return ret_ref;
62695 }
62696 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
62697         LDKPayeePubKey arg_conv;
62698         arg_conv.inner = untag_ptr(arg);
62699         arg_conv.is_owned = ptr_is_owned(arg);
62700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62701         arg_conv.is_owned = false;
62702         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
62703         return ret_conv;
62704 }
62705
62706 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
62707         LDKPayeePubKey orig_conv;
62708         orig_conv.inner = untag_ptr(orig);
62709         orig_conv.is_owned = ptr_is_owned(orig);
62710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62711         orig_conv.is_owned = false;
62712         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
62713         uint64_t ret_ref = 0;
62714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62716         return ret_ref;
62717 }
62718
62719 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
62720         LDKPayeePubKey o_conv;
62721         o_conv.inner = untag_ptr(o);
62722         o_conv.is_owned = ptr_is_owned(o);
62723         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62724         o_conv.is_owned = false;
62725         int64_t ret_conv = PayeePubKey_hash(&o_conv);
62726         return ret_conv;
62727 }
62728
62729 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
62730         LDKPayeePubKey a_conv;
62731         a_conv.inner = untag_ptr(a);
62732         a_conv.is_owned = ptr_is_owned(a);
62733         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62734         a_conv.is_owned = false;
62735         LDKPayeePubKey b_conv;
62736         b_conv.inner = untag_ptr(b);
62737         b_conv.is_owned = ptr_is_owned(b);
62738         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62739         b_conv.is_owned = false;
62740         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
62741         return ret_conv;
62742 }
62743
62744 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
62745         LDKExpiryTime this_obj_conv;
62746         this_obj_conv.inner = untag_ptr(this_obj);
62747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62749         ExpiryTime_free(this_obj_conv);
62750 }
62751
62752 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
62753         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
62754         uint64_t ret_ref = 0;
62755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62757         return ret_ref;
62758 }
62759 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
62760         LDKExpiryTime arg_conv;
62761         arg_conv.inner = untag_ptr(arg);
62762         arg_conv.is_owned = ptr_is_owned(arg);
62763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62764         arg_conv.is_owned = false;
62765         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
62766         return ret_conv;
62767 }
62768
62769 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
62770         LDKExpiryTime orig_conv;
62771         orig_conv.inner = untag_ptr(orig);
62772         orig_conv.is_owned = ptr_is_owned(orig);
62773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62774         orig_conv.is_owned = false;
62775         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
62776         uint64_t ret_ref = 0;
62777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62779         return ret_ref;
62780 }
62781
62782 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
62783         LDKExpiryTime o_conv;
62784         o_conv.inner = untag_ptr(o);
62785         o_conv.is_owned = ptr_is_owned(o);
62786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62787         o_conv.is_owned = false;
62788         int64_t ret_conv = ExpiryTime_hash(&o_conv);
62789         return ret_conv;
62790 }
62791
62792 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
62793         LDKExpiryTime a_conv;
62794         a_conv.inner = untag_ptr(a);
62795         a_conv.is_owned = ptr_is_owned(a);
62796         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62797         a_conv.is_owned = false;
62798         LDKExpiryTime b_conv;
62799         b_conv.inner = untag_ptr(b);
62800         b_conv.is_owned = ptr_is_owned(b);
62801         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62802         b_conv.is_owned = false;
62803         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
62804         return ret_conv;
62805 }
62806
62807 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
62808         LDKMinFinalCltvExpiryDelta this_obj_conv;
62809         this_obj_conv.inner = untag_ptr(this_obj);
62810         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62812         MinFinalCltvExpiryDelta_free(this_obj_conv);
62813 }
62814
62815 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
62816         LDKMinFinalCltvExpiryDelta this_ptr_conv;
62817         this_ptr_conv.inner = untag_ptr(this_ptr);
62818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62820         this_ptr_conv.is_owned = false;
62821         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
62822         return ret_conv;
62823 }
62824
62825 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
62826         LDKMinFinalCltvExpiryDelta this_ptr_conv;
62827         this_ptr_conv.inner = untag_ptr(this_ptr);
62828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62830         this_ptr_conv.is_owned = false;
62831         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
62832 }
62833
62834 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
62835         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
62836         uint64_t ret_ref = 0;
62837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62839         return ret_ref;
62840 }
62841
62842 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
62843         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
62844         uint64_t ret_ref = 0;
62845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62847         return ret_ref;
62848 }
62849 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
62850         LDKMinFinalCltvExpiryDelta arg_conv;
62851         arg_conv.inner = untag_ptr(arg);
62852         arg_conv.is_owned = ptr_is_owned(arg);
62853         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62854         arg_conv.is_owned = false;
62855         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
62856         return ret_conv;
62857 }
62858
62859 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
62860         LDKMinFinalCltvExpiryDelta orig_conv;
62861         orig_conv.inner = untag_ptr(orig);
62862         orig_conv.is_owned = ptr_is_owned(orig);
62863         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62864         orig_conv.is_owned = false;
62865         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
62866         uint64_t ret_ref = 0;
62867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62869         return ret_ref;
62870 }
62871
62872 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
62873         LDKMinFinalCltvExpiryDelta o_conv;
62874         o_conv.inner = untag_ptr(o);
62875         o_conv.is_owned = ptr_is_owned(o);
62876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62877         o_conv.is_owned = false;
62878         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
62879         return ret_conv;
62880 }
62881
62882 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
62883         LDKMinFinalCltvExpiryDelta a_conv;
62884         a_conv.inner = untag_ptr(a);
62885         a_conv.is_owned = ptr_is_owned(a);
62886         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62887         a_conv.is_owned = false;
62888         LDKMinFinalCltvExpiryDelta b_conv;
62889         b_conv.inner = untag_ptr(b);
62890         b_conv.is_owned = ptr_is_owned(b);
62891         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62892         b_conv.is_owned = false;
62893         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
62894         return ret_conv;
62895 }
62896
62897 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
62898         if (!ptr_is_owned(this_ptr)) return;
62899         void* this_ptr_ptr = untag_ptr(this_ptr);
62900         CHECK_ACCESS(this_ptr_ptr);
62901         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
62902         FREE(untag_ptr(this_ptr));
62903         Fallback_free(this_ptr_conv);
62904 }
62905
62906 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
62907         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62908         *ret_copy = Fallback_clone(arg);
62909         uint64_t ret_ref = tag_ptr(ret_copy, true);
62910         return ret_ref;
62911 }
62912 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
62913         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
62914         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
62915         return ret_conv;
62916 }
62917
62918 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
62919         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
62920         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62921         *ret_copy = Fallback_clone(orig_conv);
62922         uint64_t ret_ref = tag_ptr(ret_copy, true);
62923         return ret_ref;
62924 }
62925
62926 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
62927         
62928         LDKCVec_u8Z program_ref;
62929         program_ref.datalen = program->arr_len;
62930         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
62931         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
62932         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62933         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
62934         uint64_t ret_ref = tag_ptr(ret_copy, true);
62935         return ret_ref;
62936 }
62937
62938 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
62939         LDKTwentyBytes a_ref;
62940         CHECK(a->arr_len == 20);
62941         memcpy(a_ref.data, a->elems, 20); FREE(a);
62942         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62943         *ret_copy = Fallback_pub_key_hash(a_ref);
62944         uint64_t ret_ref = tag_ptr(ret_copy, true);
62945         return ret_ref;
62946 }
62947
62948 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
62949         LDKTwentyBytes a_ref;
62950         CHECK(a->arr_len == 20);
62951         memcpy(a_ref.data, a->elems, 20); FREE(a);
62952         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62953         *ret_copy = Fallback_script_hash(a_ref);
62954         uint64_t ret_ref = tag_ptr(ret_copy, true);
62955         return ret_ref;
62956 }
62957
62958 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
62959         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
62960         int64_t ret_conv = Fallback_hash(o_conv);
62961         return ret_conv;
62962 }
62963
62964 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
62965         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
62966         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
62967         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
62968         return ret_conv;
62969 }
62970
62971 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
62972         LDKBolt11InvoiceSignature this_obj_conv;
62973         this_obj_conv.inner = untag_ptr(this_obj);
62974         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62976         Bolt11InvoiceSignature_free(this_obj_conv);
62977 }
62978
62979 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
62980         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
62981         uint64_t ret_ref = 0;
62982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62984         return ret_ref;
62985 }
62986 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
62987         LDKBolt11InvoiceSignature arg_conv;
62988         arg_conv.inner = untag_ptr(arg);
62989         arg_conv.is_owned = ptr_is_owned(arg);
62990         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62991         arg_conv.is_owned = false;
62992         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
62993         return ret_conv;
62994 }
62995
62996 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
62997         LDKBolt11InvoiceSignature orig_conv;
62998         orig_conv.inner = untag_ptr(orig);
62999         orig_conv.is_owned = ptr_is_owned(orig);
63000         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63001         orig_conv.is_owned = false;
63002         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
63003         uint64_t ret_ref = 0;
63004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63006         return ret_ref;
63007 }
63008
63009 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
63010         LDKBolt11InvoiceSignature o_conv;
63011         o_conv.inner = untag_ptr(o);
63012         o_conv.is_owned = ptr_is_owned(o);
63013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63014         o_conv.is_owned = false;
63015         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
63016         return ret_conv;
63017 }
63018
63019 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
63020         LDKBolt11InvoiceSignature a_conv;
63021         a_conv.inner = untag_ptr(a);
63022         a_conv.is_owned = ptr_is_owned(a);
63023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63024         a_conv.is_owned = false;
63025         LDKBolt11InvoiceSignature b_conv;
63026         b_conv.inner = untag_ptr(b);
63027         b_conv.is_owned = ptr_is_owned(b);
63028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63029         b_conv.is_owned = false;
63030         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
63031         return ret_conv;
63032 }
63033
63034 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
63035         LDKPrivateRoute this_obj_conv;
63036         this_obj_conv.inner = untag_ptr(this_obj);
63037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63039         PrivateRoute_free(this_obj_conv);
63040 }
63041
63042 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
63043         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
63044         uint64_t ret_ref = 0;
63045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63047         return ret_ref;
63048 }
63049 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
63050         LDKPrivateRoute arg_conv;
63051         arg_conv.inner = untag_ptr(arg);
63052         arg_conv.is_owned = ptr_is_owned(arg);
63053         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63054         arg_conv.is_owned = false;
63055         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
63056         return ret_conv;
63057 }
63058
63059 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
63060         LDKPrivateRoute orig_conv;
63061         orig_conv.inner = untag_ptr(orig);
63062         orig_conv.is_owned = ptr_is_owned(orig);
63063         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63064         orig_conv.is_owned = false;
63065         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
63066         uint64_t ret_ref = 0;
63067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63069         return ret_ref;
63070 }
63071
63072 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
63073         LDKPrivateRoute o_conv;
63074         o_conv.inner = untag_ptr(o);
63075         o_conv.is_owned = ptr_is_owned(o);
63076         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63077         o_conv.is_owned = false;
63078         int64_t ret_conv = PrivateRoute_hash(&o_conv);
63079         return ret_conv;
63080 }
63081
63082 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
63083         LDKPrivateRoute a_conv;
63084         a_conv.inner = untag_ptr(a);
63085         a_conv.is_owned = ptr_is_owned(a);
63086         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63087         a_conv.is_owned = false;
63088         LDKPrivateRoute b_conv;
63089         b_conv.inner = untag_ptr(b);
63090         b_conv.is_owned = ptr_is_owned(b);
63091         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63092         b_conv.is_owned = false;
63093         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
63094         return ret_conv;
63095 }
63096
63097 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
63098         LDKSignedRawBolt11Invoice this_arg_conv;
63099         this_arg_conv.inner = untag_ptr(this_arg);
63100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63102         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
63103         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
63104         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
63105         return tag_ptr(ret_conv, true);
63106 }
63107
63108 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
63109         LDKSignedRawBolt11Invoice this_arg_conv;
63110         this_arg_conv.inner = untag_ptr(this_arg);
63111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63113         this_arg_conv.is_owned = false;
63114         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
63115         uint64_t ret_ref = 0;
63116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63118         return ret_ref;
63119 }
63120
63121 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
63122         LDKSignedRawBolt11Invoice this_arg_conv;
63123         this_arg_conv.inner = untag_ptr(this_arg);
63124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63126         this_arg_conv.is_owned = false;
63127         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63128         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
63129         return ret_arr;
63130 }
63131
63132 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
63133         LDKSignedRawBolt11Invoice this_arg_conv;
63134         this_arg_conv.inner = untag_ptr(this_arg);
63135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63137         this_arg_conv.is_owned = false;
63138         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
63139         uint64_t ret_ref = 0;
63140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63142         return ret_ref;
63143 }
63144
63145 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
63146         LDKSignedRawBolt11Invoice this_arg_conv;
63147         this_arg_conv.inner = untag_ptr(this_arg);
63148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63150         this_arg_conv.is_owned = false;
63151         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
63152         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
63153         return tag_ptr(ret_conv, true);
63154 }
63155
63156 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
63157         LDKSignedRawBolt11Invoice this_arg_conv;
63158         this_arg_conv.inner = untag_ptr(this_arg);
63159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63161         this_arg_conv.is_owned = false;
63162         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
63163         return ret_conv;
63164 }
63165
63166 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
63167         LDKRawBolt11Invoice this_arg_conv;
63168         this_arg_conv.inner = untag_ptr(this_arg);
63169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63171         this_arg_conv.is_owned = false;
63172         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63173         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
63174         return ret_arr;
63175 }
63176
63177 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
63178         LDKRawBolt11Invoice this_arg_conv;
63179         this_arg_conv.inner = untag_ptr(this_arg);
63180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63182         this_arg_conv.is_owned = false;
63183         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
63184         uint64_t ret_ref = 0;
63185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63187         return ret_ref;
63188 }
63189
63190 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
63191         LDKRawBolt11Invoice this_arg_conv;
63192         this_arg_conv.inner = untag_ptr(this_arg);
63193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63195         this_arg_conv.is_owned = false;
63196         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
63197         uint64_t ret_ref = 0;
63198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63200         return ret_ref;
63201 }
63202
63203 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
63204         LDKRawBolt11Invoice this_arg_conv;
63205         this_arg_conv.inner = untag_ptr(this_arg);
63206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63208         this_arg_conv.is_owned = false;
63209         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
63210         uint64_t ret_ref = 0;
63211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63213         return ret_ref;
63214 }
63215
63216 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
63217         LDKRawBolt11Invoice this_arg_conv;
63218         this_arg_conv.inner = untag_ptr(this_arg);
63219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63221         this_arg_conv.is_owned = false;
63222         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
63223         uint64_t ret_ref = 0;
63224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63226         return ret_ref;
63227 }
63228
63229 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
63230         LDKRawBolt11Invoice this_arg_conv;
63231         this_arg_conv.inner = untag_ptr(this_arg);
63232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63234         this_arg_conv.is_owned = false;
63235         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
63236         uint64_t ret_ref = 0;
63237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63239         return ret_ref;
63240 }
63241
63242 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
63243         LDKRawBolt11Invoice this_arg_conv;
63244         this_arg_conv.inner = untag_ptr(this_arg);
63245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63247         this_arg_conv.is_owned = false;
63248         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
63249         uint64_t ret_ref = 0;
63250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63252         return ret_ref;
63253 }
63254
63255 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
63256         LDKRawBolt11Invoice this_arg_conv;
63257         this_arg_conv.inner = untag_ptr(this_arg);
63258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63260         this_arg_conv.is_owned = false;
63261         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
63262         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
63263         uint64_t ret_ref = tag_ptr(ret_copy, true);
63264         return ret_ref;
63265 }
63266
63267 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
63268         LDKRawBolt11Invoice this_arg_conv;
63269         this_arg_conv.inner = untag_ptr(this_arg);
63270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63272         this_arg_conv.is_owned = false;
63273         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63274         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
63275         uint64_t ret_ref = tag_ptr(ret_copy, true);
63276         return ret_ref;
63277 }
63278
63279 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
63280         LDKRawBolt11Invoice this_arg_conv;
63281         this_arg_conv.inner = untag_ptr(this_arg);
63282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63284         this_arg_conv.is_owned = false;
63285         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
63286         uint64_t ret_ref = 0;
63287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63289         return ret_ref;
63290 }
63291
63292 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
63293         LDKRawBolt11Invoice this_arg_conv;
63294         this_arg_conv.inner = untag_ptr(this_arg);
63295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63297         this_arg_conv.is_owned = false;
63298         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
63299         uint64_tArray ret_arr = NULL;
63300         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63301         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63302         for (size_t o = 0; o < ret_var.datalen; o++) {
63303                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
63304                 uint64_t ret_conv_14_ref = 0;
63305                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
63306                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
63307                 ret_arr_ptr[o] = ret_conv_14_ref;
63308         }
63309         
63310         FREE(ret_var.data);
63311         return ret_arr;
63312 }
63313
63314 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
63315         LDKRawBolt11Invoice this_arg_conv;
63316         this_arg_conv.inner = untag_ptr(this_arg);
63317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63319         this_arg_conv.is_owned = false;
63320         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63321         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
63322         uint64_t ret_ref = tag_ptr(ret_copy, true);
63323         return ret_ref;
63324 }
63325
63326 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
63327         LDKRawBolt11Invoice this_arg_conv;
63328         this_arg_conv.inner = untag_ptr(this_arg);
63329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63331         this_arg_conv.is_owned = false;
63332         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
63333         return ret_conv;
63334 }
63335
63336 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
63337         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
63338         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
63339         return tag_ptr(ret_conv, true);
63340 }
63341
63342 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
63343         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
63344         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
63345         return tag_ptr(ret_conv, true);
63346 }
63347
63348 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
63349         LDKPositiveTimestamp this_arg_conv;
63350         this_arg_conv.inner = untag_ptr(this_arg);
63351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63353         this_arg_conv.is_owned = false;
63354         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
63355         return ret_conv;
63356 }
63357
63358 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
63359         LDKPositiveTimestamp this_arg_conv;
63360         this_arg_conv.inner = untag_ptr(this_arg);
63361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63363         this_arg_conv.is_owned = false;
63364         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
63365         return ret_conv;
63366 }
63367
63368 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
63369         LDKBolt11Invoice this_arg_conv;
63370         this_arg_conv.inner = untag_ptr(this_arg);
63371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63373         this_arg_conv.is_owned = false;
63374         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63375         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
63376         return ret_arr;
63377 }
63378
63379 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
63380         LDKBolt11Invoice this_arg_conv;
63381         this_arg_conv.inner = untag_ptr(this_arg);
63382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63384         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
63385         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
63386         uint64_t ret_ref = 0;
63387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63389         return ret_ref;
63390 }
63391
63392 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
63393         LDKBolt11Invoice this_arg_conv;
63394         this_arg_conv.inner = untag_ptr(this_arg);
63395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63397         this_arg_conv.is_owned = false;
63398         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
63399         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
63400         return tag_ptr(ret_conv, true);
63401 }
63402
63403 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
63404         LDKSignedRawBolt11Invoice signed_invoice_conv;
63405         signed_invoice_conv.inner = untag_ptr(signed_invoice);
63406         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
63407         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
63408         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
63409         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
63410         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
63411         return tag_ptr(ret_conv, true);
63412 }
63413
63414 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
63415         LDKBolt11Invoice this_arg_conv;
63416         this_arg_conv.inner = untag_ptr(this_arg);
63417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63419         this_arg_conv.is_owned = false;
63420         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
63421         return ret_conv;
63422 }
63423
63424 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
63425         LDKBolt11Invoice this_arg_conv;
63426         this_arg_conv.inner = untag_ptr(this_arg);
63427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63429         this_arg_conv.is_owned = false;
63430         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63431         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
63432         return ret_arr;
63433 }
63434
63435 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
63436         LDKBolt11Invoice this_arg_conv;
63437         this_arg_conv.inner = untag_ptr(this_arg);
63438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63440         this_arg_conv.is_owned = false;
63441         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63442         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
63443         return ret_arr;
63444 }
63445
63446 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
63447         LDKBolt11Invoice this_arg_conv;
63448         this_arg_conv.inner = untag_ptr(this_arg);
63449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63451         this_arg_conv.is_owned = false;
63452         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63453         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
63454         return ret_arr;
63455 }
63456
63457 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
63458         LDKBolt11Invoice this_arg_conv;
63459         this_arg_conv.inner = untag_ptr(this_arg);
63460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63462         this_arg_conv.is_owned = false;
63463         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63464         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
63465         uint64_t ret_ref = tag_ptr(ret_copy, true);
63466         return ret_ref;
63467 }
63468
63469 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
63470         LDKBolt11Invoice this_arg_conv;
63471         this_arg_conv.inner = untag_ptr(this_arg);
63472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63474         this_arg_conv.is_owned = false;
63475         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
63476         uint64_t ret_ref = 0;
63477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63479         return ret_ref;
63480 }
63481
63482 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
63483         LDKBolt11Invoice this_arg_conv;
63484         this_arg_conv.inner = untag_ptr(this_arg);
63485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63487         this_arg_conv.is_owned = false;
63488         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63489         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
63490         return ret_arr;
63491 }
63492
63493 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
63494         LDKBolt11Invoice this_arg_conv;
63495         this_arg_conv.inner = untag_ptr(this_arg);
63496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63498         this_arg_conv.is_owned = false;
63499         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
63500         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
63501         uint64_t ret_ref = tag_ptr(ret_copy, true);
63502         return ret_ref;
63503 }
63504
63505 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
63506         LDKBolt11Invoice this_arg_conv;
63507         this_arg_conv.inner = untag_ptr(this_arg);
63508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63510         this_arg_conv.is_owned = false;
63511         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
63512         return ret_conv;
63513 }
63514
63515 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
63516         LDKBolt11Invoice this_arg_conv;
63517         this_arg_conv.inner = untag_ptr(this_arg);
63518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63520         this_arg_conv.is_owned = false;
63521         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
63522         return ret_conv;
63523 }
63524
63525 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
63526         LDKBolt11Invoice this_arg_conv;
63527         this_arg_conv.inner = untag_ptr(this_arg);
63528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63530         this_arg_conv.is_owned = false;
63531         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
63532         return ret_conv;
63533 }
63534
63535 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
63536         LDKBolt11Invoice this_arg_conv;
63537         this_arg_conv.inner = untag_ptr(this_arg);
63538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63540         this_arg_conv.is_owned = false;
63541         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
63542         return ret_conv;
63543 }
63544
63545 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
63546         LDKBolt11Invoice this_arg_conv;
63547         this_arg_conv.inner = untag_ptr(this_arg);
63548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63550         this_arg_conv.is_owned = false;
63551         LDKCVec_AddressZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
63552         ptrArray ret_arr = NULL;
63553         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
63554         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
63555         for (size_t i = 0; i < ret_var.datalen; i++) {
63556                 LDKStr ret_conv_8_str = ret_var.data[i];
63557                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
63558                 Str_free(ret_conv_8_str);
63559                 ret_arr_ptr[i] = ret_conv_8_conv;
63560         }
63561         
63562         FREE(ret_var.data);
63563         return ret_arr;
63564 }
63565
63566 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
63567         LDKBolt11Invoice this_arg_conv;
63568         this_arg_conv.inner = untag_ptr(this_arg);
63569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63571         this_arg_conv.is_owned = false;
63572         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
63573         uint64_tArray ret_arr = NULL;
63574         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63575         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63576         for (size_t o = 0; o < ret_var.datalen; o++) {
63577                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
63578                 uint64_t ret_conv_14_ref = 0;
63579                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
63580                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
63581                 ret_arr_ptr[o] = ret_conv_14_ref;
63582         }
63583         
63584         FREE(ret_var.data);
63585         return ret_arr;
63586 }
63587
63588 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
63589         LDKBolt11Invoice this_arg_conv;
63590         this_arg_conv.inner = untag_ptr(this_arg);
63591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63593         this_arg_conv.is_owned = false;
63594         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
63595         uint64_tArray ret_arr = NULL;
63596         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63597         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63598         for (size_t l = 0; l < ret_var.datalen; l++) {
63599                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
63600                 uint64_t ret_conv_11_ref = 0;
63601                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
63602                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
63603                 ret_arr_ptr[l] = ret_conv_11_ref;
63604         }
63605         
63606         FREE(ret_var.data);
63607         return ret_arr;
63608 }
63609
63610 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
63611         LDKBolt11Invoice this_arg_conv;
63612         this_arg_conv.inner = untag_ptr(this_arg);
63613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63615         this_arg_conv.is_owned = false;
63616         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
63617         return ret_conv;
63618 }
63619
63620 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
63621         LDKBolt11Invoice this_arg_conv;
63622         this_arg_conv.inner = untag_ptr(this_arg);
63623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63625         this_arg_conv.is_owned = false;
63626         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63627         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
63628         uint64_t ret_ref = tag_ptr(ret_copy, true);
63629         return ret_ref;
63630 }
63631
63632 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
63633         LDKStr description_conv = str_ref_to_owned_c(description);
63634         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
63635         *ret_conv = Description_new(description_conv);
63636         return tag_ptr(ret_conv, true);
63637 }
63638
63639 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
63640         LDKDescription this_arg_conv;
63641         this_arg_conv.inner = untag_ptr(this_arg);
63642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63644         this_arg_conv = Description_clone(&this_arg_conv);
63645         LDKStr ret_str = Description_into_inner(this_arg_conv);
63646         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63647         Str_free(ret_str);
63648         return ret_conv;
63649 }
63650
63651 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
63652         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
63653         uint64_t ret_ref = 0;
63654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63656         return ret_ref;
63657 }
63658
63659 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
63660         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
63661         uint64_t ret_ref = 0;
63662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63664         return ret_ref;
63665 }
63666
63667 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
63668         LDKExpiryTime this_arg_conv;
63669         this_arg_conv.inner = untag_ptr(this_arg);
63670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63672         this_arg_conv.is_owned = false;
63673         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
63674         return ret_conv;
63675 }
63676
63677 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
63678         LDKExpiryTime this_arg_conv;
63679         this_arg_conv.inner = untag_ptr(this_arg);
63680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63682         this_arg_conv.is_owned = false;
63683         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
63684         return ret_conv;
63685 }
63686
63687 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
63688         LDKRouteHint hops_conv;
63689         hops_conv.inner = untag_ptr(hops);
63690         hops_conv.is_owned = ptr_is_owned(hops);
63691         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
63692         hops_conv = RouteHint_clone(&hops_conv);
63693         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
63694         *ret_conv = PrivateRoute_new(hops_conv);
63695         return tag_ptr(ret_conv, true);
63696 }
63697
63698 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
63699         LDKPrivateRoute this_arg_conv;
63700         this_arg_conv.inner = untag_ptr(this_arg);
63701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63703         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
63704         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
63705         uint64_t ret_ref = 0;
63706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63708         return ret_ref;
63709 }
63710
63711 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
63712         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
63713         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
63714         return ret_conv;
63715 }
63716
63717 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
63718         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
63719         return ret_conv;
63720 }
63721
63722 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
63723         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
63724         return ret_conv;
63725 }
63726
63727 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
63728         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
63729         return ret_conv;
63730 }
63731
63732 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
63733         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
63734         return ret_conv;
63735 }
63736
63737 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
63738         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
63739         return ret_conv;
63740 }
63741
63742 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
63743         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
63744         return ret_conv;
63745 }
63746
63747 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
63748         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
63749         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
63750         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
63751         return ret_conv;
63752 }
63753
63754 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
63755         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
63756         LDKStr ret_str = CreationError_to_str(o_conv);
63757         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63758         Str_free(ret_str);
63759         return ret_conv;
63760 }
63761
63762 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
63763         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
63764         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
63765         return ret_conv;
63766 }
63767
63768 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
63769         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
63770         return ret_conv;
63771 }
63772
63773 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
63774         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
63775         return ret_conv;
63776 }
63777
63778 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
63779         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
63780         return ret_conv;
63781 }
63782
63783 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
63784         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
63785         return ret_conv;
63786 }
63787
63788 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
63789         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
63790         return ret_conv;
63791 }
63792
63793 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
63794         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
63795         return ret_conv;
63796 }
63797
63798 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
63799         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
63800         return ret_conv;
63801 }
63802
63803 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
63804         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
63805         return ret_conv;
63806 }
63807
63808 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
63809         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
63810         return ret_conv;
63811 }
63812
63813 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
63814         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
63815         return ret_conv;
63816 }
63817
63818 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
63819         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
63820         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
63821         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
63822         return ret_conv;
63823 }
63824
63825 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
63826         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
63827         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
63828         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63829         Str_free(ret_str);
63830         return ret_conv;
63831 }
63832
63833 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
63834         if (!ptr_is_owned(this_ptr)) return;
63835         void* this_ptr_ptr = untag_ptr(this_ptr);
63836         CHECK_ACCESS(this_ptr_ptr);
63837         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
63838         FREE(untag_ptr(this_ptr));
63839         SignOrCreationError_free(this_ptr_conv);
63840 }
63841
63842 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
63843         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
63844         *ret_copy = SignOrCreationError_clone(arg);
63845         uint64_t ret_ref = tag_ptr(ret_copy, true);
63846         return ret_ref;
63847 }
63848 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
63849         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
63850         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
63851         return ret_conv;
63852 }
63853
63854 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
63855         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
63856         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
63857         *ret_copy = SignOrCreationError_clone(orig_conv);
63858         uint64_t ret_ref = tag_ptr(ret_copy, true);
63859         return ret_ref;
63860 }
63861
63862 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
63863         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
63864         *ret_copy = SignOrCreationError_sign_error();
63865         uint64_t ret_ref = tag_ptr(ret_copy, true);
63866         return ret_ref;
63867 }
63868
63869 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
63870         LDKCreationError a_conv = LDKCreationError_from_js(a);
63871         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
63872         *ret_copy = SignOrCreationError_creation_error(a_conv);
63873         uint64_t ret_ref = tag_ptr(ret_copy, true);
63874         return ret_ref;
63875 }
63876
63877 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
63878         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
63879         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
63880         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
63881         return ret_conv;
63882 }
63883
63884 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
63885         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
63886         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
63887         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63888         Str_free(ret_str);
63889         return ret_conv;
63890 }
63891
63892 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
63893         LDKBolt11Invoice invoice_conv;
63894         invoice_conv.inner = untag_ptr(invoice);
63895         invoice_conv.is_owned = ptr_is_owned(invoice);
63896         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
63897         invoice_conv.is_owned = false;
63898         void* retry_strategy_ptr = untag_ptr(retry_strategy);
63899         CHECK_ACCESS(retry_strategy_ptr);
63900         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
63901         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
63902         LDKChannelManager channelmanager_conv;
63903         channelmanager_conv.inner = untag_ptr(channelmanager);
63904         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
63905         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
63906         channelmanager_conv.is_owned = false;
63907         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
63908         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
63909         return tag_ptr(ret_conv, true);
63910 }
63911
63912 uint64_t  __attribute__((export_name("TS_pay_invoice_with_id"))) TS_pay_invoice_with_id(uint64_t invoice, int8_tArray payment_id, uint64_t retry_strategy, uint64_t channelmanager) {
63913         LDKBolt11Invoice invoice_conv;
63914         invoice_conv.inner = untag_ptr(invoice);
63915         invoice_conv.is_owned = ptr_is_owned(invoice);
63916         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
63917         invoice_conv.is_owned = false;
63918         LDKThirtyTwoBytes payment_id_ref;
63919         CHECK(payment_id->arr_len == 32);
63920         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63921         void* retry_strategy_ptr = untag_ptr(retry_strategy);
63922         CHECK_ACCESS(retry_strategy_ptr);
63923         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
63924         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
63925         LDKChannelManager channelmanager_conv;
63926         channelmanager_conv.inner = untag_ptr(channelmanager);
63927         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
63928         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
63929         channelmanager_conv.is_owned = false;
63930         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
63931         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
63932         return tag_ptr(ret_conv, true);
63933 }
63934
63935 uint64_t  __attribute__((export_name("TS_pay_zero_value_invoice"))) TS_pay_zero_value_invoice(uint64_t invoice, int64_t amount_msats, uint64_t retry_strategy, uint64_t channelmanager) {
63936         LDKBolt11Invoice invoice_conv;
63937         invoice_conv.inner = untag_ptr(invoice);
63938         invoice_conv.is_owned = ptr_is_owned(invoice);
63939         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
63940         invoice_conv.is_owned = false;
63941         void* retry_strategy_ptr = untag_ptr(retry_strategy);
63942         CHECK_ACCESS(retry_strategy_ptr);
63943         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
63944         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
63945         LDKChannelManager channelmanager_conv;
63946         channelmanager_conv.inner = untag_ptr(channelmanager);
63947         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
63948         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
63949         channelmanager_conv.is_owned = false;
63950         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
63951         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
63952         return tag_ptr(ret_conv, true);
63953 }
63954
63955 uint64_t  __attribute__((export_name("TS_pay_zero_value_invoice_with_id"))) TS_pay_zero_value_invoice_with_id(uint64_t invoice, int64_t amount_msats, int8_tArray payment_id, uint64_t retry_strategy, uint64_t channelmanager) {
63956         LDKBolt11Invoice invoice_conv;
63957         invoice_conv.inner = untag_ptr(invoice);
63958         invoice_conv.is_owned = ptr_is_owned(invoice);
63959         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
63960         invoice_conv.is_owned = false;
63961         LDKThirtyTwoBytes payment_id_ref;
63962         CHECK(payment_id->arr_len == 32);
63963         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63964         void* retry_strategy_ptr = untag_ptr(retry_strategy);
63965         CHECK_ACCESS(retry_strategy_ptr);
63966         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
63967         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
63968         LDKChannelManager channelmanager_conv;
63969         channelmanager_conv.inner = untag_ptr(channelmanager);
63970         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
63971         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
63972         channelmanager_conv.is_owned = false;
63973         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
63974         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
63975         return tag_ptr(ret_conv, true);
63976 }
63977
63978 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
63979         if (!ptr_is_owned(this_ptr)) return;
63980         void* this_ptr_ptr = untag_ptr(this_ptr);
63981         CHECK_ACCESS(this_ptr_ptr);
63982         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
63983         FREE(untag_ptr(this_ptr));
63984         PaymentError_free(this_ptr_conv);
63985 }
63986
63987 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
63988         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
63989         *ret_copy = PaymentError_clone(arg);
63990         uint64_t ret_ref = tag_ptr(ret_copy, true);
63991         return ret_ref;
63992 }
63993 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
63994         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
63995         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
63996         return ret_conv;
63997 }
63998
63999 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
64000         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
64001         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
64002         *ret_copy = PaymentError_clone(orig_conv);
64003         uint64_t ret_ref = tag_ptr(ret_copy, true);
64004         return ret_ref;
64005 }
64006
64007 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
64008         LDKStr a_conv = str_ref_to_owned_c(a);
64009         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
64010         *ret_copy = PaymentError_invoice(a_conv);
64011         uint64_t ret_ref = tag_ptr(ret_copy, true);
64012         return ret_ref;
64013 }
64014
64015 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
64016         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
64017         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
64018         *ret_copy = PaymentError_sending(a_conv);
64019         uint64_t ret_ref = tag_ptr(ret_copy, true);
64020         return ret_ref;
64021 }
64022
64023 jboolean  __attribute__((export_name("TS_PaymentError_eq"))) TS_PaymentError_eq(uint64_t a, uint64_t b) {
64024         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
64025         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
64026         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
64027         return ret_conv;
64028 }
64029
64030 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) {
64031         void* amt_msat_ptr = untag_ptr(amt_msat);
64032         CHECK_ACCESS(amt_msat_ptr);
64033         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64034         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64035         void* payment_hash_ptr = untag_ptr(payment_hash);
64036         CHECK_ACCESS(payment_hash_ptr);
64037         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
64038         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
64039         LDKStr description_conv = str_ref_to_owned_c(description);
64040         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
64041         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
64042         if (phantom_route_hints_constr.datalen > 0)
64043                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
64044         else
64045                 phantom_route_hints_constr.data = NULL;
64046         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
64047         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
64048                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
64049                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
64050                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
64051                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
64052                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
64053                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
64054                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
64055         }
64056         FREE(phantom_route_hints);
64057         void* entropy_source_ptr = untag_ptr(entropy_source);
64058         CHECK_ACCESS(entropy_source_ptr);
64059         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64060         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64061                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64062                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64063         }
64064         void* node_signer_ptr = untag_ptr(node_signer);
64065         CHECK_ACCESS(node_signer_ptr);
64066         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64067         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64068                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64069                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64070         }
64071         void* logger_ptr = untag_ptr(logger);
64072         CHECK_ACCESS(logger_ptr);
64073         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64074         if (logger_conv.free == LDKLogger_JCalls_free) {
64075                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64076                 LDKLogger_JCalls_cloned(&logger_conv);
64077         }
64078         LDKCurrency network_conv = LDKCurrency_from_js(network);
64079         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64080         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64081         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64082         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64083         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64084         *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);
64085         return tag_ptr(ret_conv, true);
64086 }
64087
64088 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) {
64089         void* amt_msat_ptr = untag_ptr(amt_msat);
64090         CHECK_ACCESS(amt_msat_ptr);
64091         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64092         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64093         void* payment_hash_ptr = untag_ptr(payment_hash);
64094         CHECK_ACCESS(payment_hash_ptr);
64095         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
64096         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
64097         LDKSha256 description_hash_conv;
64098         description_hash_conv.inner = untag_ptr(description_hash);
64099         description_hash_conv.is_owned = ptr_is_owned(description_hash);
64100         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
64101         description_hash_conv = Sha256_clone(&description_hash_conv);
64102         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
64103         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
64104         if (phantom_route_hints_constr.datalen > 0)
64105                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
64106         else
64107                 phantom_route_hints_constr.data = NULL;
64108         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
64109         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
64110                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
64111                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
64112                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
64113                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
64114                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
64115                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
64116                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
64117         }
64118         FREE(phantom_route_hints);
64119         void* entropy_source_ptr = untag_ptr(entropy_source);
64120         CHECK_ACCESS(entropy_source_ptr);
64121         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64122         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64123                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64124                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64125         }
64126         void* node_signer_ptr = untag_ptr(node_signer);
64127         CHECK_ACCESS(node_signer_ptr);
64128         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64129         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64130                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64131                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64132         }
64133         void* logger_ptr = untag_ptr(logger);
64134         CHECK_ACCESS(logger_ptr);
64135         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64136         if (logger_conv.free == LDKLogger_JCalls_free) {
64137                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64138                 LDKLogger_JCalls_cloned(&logger_conv);
64139         }
64140         LDKCurrency network_conv = LDKCurrency_from_js(network);
64141         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64142         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64143         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64144         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64145         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64146         *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);
64147         return tag_ptr(ret_conv, true);
64148 }
64149
64150 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) {
64151         LDKChannelManager channelmanager_conv;
64152         channelmanager_conv.inner = untag_ptr(channelmanager);
64153         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
64154         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
64155         channelmanager_conv.is_owned = false;
64156         void* node_signer_ptr = untag_ptr(node_signer);
64157         CHECK_ACCESS(node_signer_ptr);
64158         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64159         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64160                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64161                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64162         }
64163         void* logger_ptr = untag_ptr(logger);
64164         CHECK_ACCESS(logger_ptr);
64165         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64166         if (logger_conv.free == LDKLogger_JCalls_free) {
64167                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64168                 LDKLogger_JCalls_cloned(&logger_conv);
64169         }
64170         LDKCurrency network_conv = LDKCurrency_from_js(network);
64171         void* amt_msat_ptr = untag_ptr(amt_msat);
64172         CHECK_ACCESS(amt_msat_ptr);
64173         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64174         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64175         LDKSha256 description_hash_conv;
64176         description_hash_conv.inner = untag_ptr(description_hash);
64177         description_hash_conv.is_owned = ptr_is_owned(description_hash);
64178         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
64179         description_hash_conv = Sha256_clone(&description_hash_conv);
64180         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64181         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64182         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64183         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64184         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64185         *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);
64186         return tag_ptr(ret_conv, true);
64187 }
64188
64189 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) {
64190         LDKChannelManager channelmanager_conv;
64191         channelmanager_conv.inner = untag_ptr(channelmanager);
64192         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
64193         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
64194         channelmanager_conv.is_owned = false;
64195         void* node_signer_ptr = untag_ptr(node_signer);
64196         CHECK_ACCESS(node_signer_ptr);
64197         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64198         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64199                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64200                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64201         }
64202         void* logger_ptr = untag_ptr(logger);
64203         CHECK_ACCESS(logger_ptr);
64204         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64205         if (logger_conv.free == LDKLogger_JCalls_free) {
64206                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64207                 LDKLogger_JCalls_cloned(&logger_conv);
64208         }
64209         LDKCurrency network_conv = LDKCurrency_from_js(network);
64210         void* amt_msat_ptr = untag_ptr(amt_msat);
64211         CHECK_ACCESS(amt_msat_ptr);
64212         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64213         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64214         LDKStr description_conv = str_ref_to_owned_c(description);
64215         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64216         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64217         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64218         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64219         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64220         *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);
64221         return tag_ptr(ret_conv, true);
64222 }
64223
64224 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) {
64225         LDKChannelManager channelmanager_conv;
64226         channelmanager_conv.inner = untag_ptr(channelmanager);
64227         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
64228         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
64229         channelmanager_conv.is_owned = false;
64230         void* node_signer_ptr = untag_ptr(node_signer);
64231         CHECK_ACCESS(node_signer_ptr);
64232         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64233         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64234                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64235                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64236         }
64237         void* logger_ptr = untag_ptr(logger);
64238         CHECK_ACCESS(logger_ptr);
64239         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64240         if (logger_conv.free == LDKLogger_JCalls_free) {
64241                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64242                 LDKLogger_JCalls_cloned(&logger_conv);
64243         }
64244         LDKCurrency network_conv = LDKCurrency_from_js(network);
64245         void* amt_msat_ptr = untag_ptr(amt_msat);
64246         CHECK_ACCESS(amt_msat_ptr);
64247         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64248         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64249         LDKStr description_conv = str_ref_to_owned_c(description);
64250         LDKThirtyTwoBytes payment_hash_ref;
64251         CHECK(payment_hash->arr_len == 32);
64252         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64253         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64254         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64255         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64256         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64257         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64258         *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);
64259         return tag_ptr(ret_conv, true);
64260 }
64261
64262 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
64263         LDKStr s_conv = str_ref_to_owned_c(s);
64264         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
64265         *ret_conv = SiPrefix_from_str(s_conv);
64266         return tag_ptr(ret_conv, true);
64267 }
64268
64269 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
64270         LDKStr s_conv = str_ref_to_owned_c(s);
64271         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
64272         *ret_conv = Bolt11Invoice_from_str(s_conv);
64273         return tag_ptr(ret_conv, true);
64274 }
64275
64276 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
64277         LDKStr s_conv = str_ref_to_owned_c(s);
64278         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
64279         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
64280         return tag_ptr(ret_conv, true);
64281 }
64282
64283 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
64284         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
64285         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
64286         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64287         Str_free(ret_str);
64288         return ret_conv;
64289 }
64290
64291 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
64292         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
64293         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
64294         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64295         Str_free(ret_str);
64296         return ret_conv;
64297 }
64298
64299 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
64300         LDKBolt11Invoice o_conv;
64301         o_conv.inner = untag_ptr(o);
64302         o_conv.is_owned = ptr_is_owned(o);
64303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64304         o_conv.is_owned = false;
64305         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
64306         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64307         Str_free(ret_str);
64308         return ret_conv;
64309 }
64310
64311 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
64312         LDKSignedRawBolt11Invoice o_conv;
64313         o_conv.inner = untag_ptr(o);
64314         o_conv.is_owned = ptr_is_owned(o);
64315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64316         o_conv.is_owned = false;
64317         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
64318         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64319         Str_free(ret_str);
64320         return ret_conv;
64321 }
64322
64323 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
64324         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
64325         LDKStr ret_str = Currency_to_str(o_conv);
64326         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64327         Str_free(ret_str);
64328         return ret_conv;
64329 }
64330
64331 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
64332         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
64333         LDKStr ret_str = SiPrefix_to_str(o_conv);
64334         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64335         Str_free(ret_str);
64336         return ret_conv;
64337 }
64338